Add parserTests for tilde and equals signs in links.
[lhc/web/wiklou.git] / tests / parser / parserTests.txt
1 # MediaWiki Parser test cases
2 # Some taken from http://meta.wikimedia.org/wiki/Parser_testing
3 # All (C) their respective authors and released under the GPL
4 #
5 # The syntax should be fairly self-explanatory.
6 #
7 # Currently supported test options:
8 # One of the following three:
9 #
10 # (default) generate HTML output
11 # pst apply pre-save transform
12 # msg apply message transform
13 #
14 # Plus any combination of these:
15 #
16 # cat add category links
17 # ill add inter-language links
18 # subpage enable subpages (disabled by default)
19 # noxml don't check for XML well formdness
20 # title=[[XXX]] run test using article title XXX
21 # language=XXX set content language to XXX for this test
22 # variant=XXX set the variant of language for this test (eg zh-tw)
23 # disabled do not run test
24 # parsoid parsoid-only test (not run by PHP parser)
25 # php php-only test (not run by the parsoid parser)
26 # showtitle make the first line the title
27 # comment run through Linker::formatComment() instead of main parser
28 # local format section links in edit comment text as local links
29 #
30 # For testing purposes, temporary articles can created:
31 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
32 # where '/' denotes a newline.
33
34 # This is the standard article assumed to exist.
35 !! article
36 Main Page
37 !! text
38 blah blah
39 !! endarticle
40
41 !!article
42 Template:Foo
43 !!text
44 FOO
45 !!endarticle
46
47 !! article
48 Template:Blank
49 !! text
50 !! endarticle
51
52 !! article
53 Template:pipe
54 !! text
55 |
56 !! endarticle
57
58 !!article
59 MediaWiki:bad image list
60 !!text
61 * [[File:Bad.jpg]] except [[Nasty page]]
62 !!endarticle
63
64 !! article
65 Template:inner list
66 !! text
67 * item 1
68 !! endarticle
69
70 !! article
71 Template:tbl-start
72 !! text
73 {|
74 !! endarticle
75
76 !! article
77 Template:tbl-end
78 !! text
79 |}
80 !! endarticle
81
82 !! article
83 Template:!
84 !! text
85 |
86 !! endarticle
87
88 !! article
89 Template:echo
90 !! text
91 {{{1}}}
92 !! endarticle
93
94 !! article
95 Template:echo_with_span
96 !! text
97 <span>{{{1}}}</span>
98 !! endarticle
99
100 !! article
101 Template:echo_with_div
102 !! text
103 <div>{{{1}}}</div>
104 !! endarticle
105
106 !! article
107 Template:attr_str
108 !! text
109 {{{1}}}="{{{2}}}"
110 !! endarticle
111
112 !! article
113 Template:table_attribs
114 !! text
115 <noinclude>
116 |</noinclude>style="color: red"| Foo
117 !! endarticle
118
119 !! article
120 A?b
121 !! text
122 Weirdo titles!
123 !! endarticle
124
125 ###
126 ### Basic tests
127 ###
128 !! test
129 Blank input
130 !! input
131 !! result
132 !! end
133
134
135 !! test
136 Simple paragraph
137 !! input
138 This is a simple paragraph.
139 !! result
140 <p>This is a simple paragraph.
141 </p>
142 !! end
143
144 !! test
145 Paragraphs with extra newline spacing
146 !! input
147 foo
148
149 bar
150
151
152 baz
153
154
155
156 booz
157 !! result
158 <p>foo
159 </p><p>bar
160 </p><p><br />
161 baz
162 </p><p><br />
163 </p><p>booz
164 </p>
165 !! end
166
167 !! test
168 Paragraphs with newline spacing with comment lines in between
169 !! input
170 ----
171 a
172 <!--foo-->
173 b
174 ----
175 a
176 <!--foo--><!--More than 1 comment disables stripping of this line!-->
177 b
178 ----
179 a
180 <!--foo-->
181
182 b
183 ----
184 a
185
186 <!--foo-->
187 b
188 ----
189 a
190 <!--foo-->
191
192
193 b
194 ----
195 a
196
197
198 <!--foo-->
199 b
200 ----
201 !! result
202 <hr />
203 <p>a
204 b
205 </p>
206 <hr />
207 <p>a
208 </p><p>b
209 </p>
210 <hr />
211 <p>a
212 </p><p>b
213 </p>
214 <hr />
215 <p>a
216 </p><p>b
217 </p>
218 <hr />
219 <p>a
220 </p><p><br />
221 b
222 </p>
223 <hr />
224 <p>a
225 </p><p><br />
226 b
227 </p>
228 <hr />
229
230 !! end
231
232 !! test
233 Paragraphs with newline spacing with non-empty white-space lines in between
234 !! input
235 ----
236 a
237
238 b
239 ----
240 a
241
242
243 b
244 ----
245 !! result
246 <hr />
247 <p>a
248 </p><p>b
249 </p>
250 <hr />
251 <p>a
252 </p><p><br />
253 b
254 </p>
255 <hr />
256
257 !! end
258
259 !! test
260 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
261 !! input
262 ----
263 a
264 <!--foo-->
265 b
266 ----
267 a
268 <!--foo--><!--More than 1 comment disables stripping of this line!-->
269 b
270 ----
271 a
272
273 <!--foo-->
274 <!--bar-->
275 b
276 ----
277 a
278
279 <!--foo-->
280 <!--bar-->
281
282 b
283 ----
284 !! result
285 <hr />
286 <p>a
287 b
288 </p>
289 <hr />
290 <p>a
291 </p><p>b
292 </p>
293 <hr />
294 <p>a
295 </p><p>b
296 </p>
297 <hr />
298 <p>a
299 </p><p><br />
300 b
301 </p>
302 <hr />
303
304 !! end
305
306 !! test
307 Parsing an URL
308 !! input
309 http://fr.wikipedia.org/wiki/🍺
310 <!-- EasterEgg we love beer, better be able be able to link to it -->
311 !! result
312 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
313 </p>
314 !! end
315
316 !! test
317 Simple list
318 !! input
319 * Item 1
320 * Item 2
321 !! result
322 <ul><li> Item 1
323 </li><li> Item 2
324 </li></ul>
325
326 !! end
327
328 !! test
329 Italics and bold
330 !! input
331 * plain
332 * plain''italic''plain
333 * plain''italic''plain''italic''plain
334 * plain'''bold'''plain
335 * plain'''bold'''plain'''bold'''plain
336 * plain''italic''plain'''bold'''plain
337 * plain'''bold'''plain''italic''plain
338 * plain''italic'''bold-italic'''italic''plain
339 * plain'''bold''bold-italic''bold'''plain
340 * plain'''''bold-italic'''italic''plain
341 * plain'''''bold-italic''bold'''plain
342 * plain''italic'''bold-italic'''''plain
343 * plain'''bold''bold-italic'''''plain
344 * plain l'''italic''plain
345 * plain l''''bold''' plain
346 !! result
347 <ul><li> plain
348 </li><li> plain<i>italic</i>plain
349 </li><li> plain<i>italic</i>plain<i>italic</i>plain
350 </li><li> plain<b>bold</b>plain
351 </li><li> plain<b>bold</b>plain<b>bold</b>plain
352 </li><li> plain<i>italic</i>plain<b>bold</b>plain
353 </li><li> plain<b>bold</b>plain<i>italic</i>plain
354 </li><li> plain<i>italic<b>bold-italic</b>italic</i>plain
355 </li><li> plain<b>bold<i>bold-italic</i>bold</b>plain
356 </li><li> plain<i><b>bold-italic</b>italic</i>plain
357 </li><li> plain<b><i>bold-italic</i>bold</b>plain
358 </li><li> plain<i>italic<b>bold-italic</b></i>plain
359 </li><li> plain<b>bold<i>bold-italic</i></b>plain
360 </li><li> plain l'<i>italic</i>plain
361 </li><li> plain l'<b>bold</b> plain
362 </li></ul>
363
364 !! end
365
366 # this example taken from the simple/Moon article
367 !! test
368 Italics and possessives
369 !! input
370 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
371 !! result
372 <p>obtained by <i><a href="/index.php?title=Lunar_Prospector&amp;action=edit&amp;redlink=1" class="new" title="Lunar Prospector (page does not exist)">Lunar Prospector</a>'</i>s gamma-ray spectrometer
373 </p>
374 !! end
375
376 ###
377 ### 2-quote opening sequence tests
378 ###
379 !! test
380 Italics and bold: 2-quote opening sequence: (2,2)
381 !! input
382 ''foo''
383 !! result
384 <p><i>foo</i>
385 </p>
386 !!end
387
388
389 !! test
390 Italics and bold: 2-quote opening sequence: (2,3)
391 !! input
392 ''foo'''
393 !! result
394 <p><i>foo'</i>
395 </p>
396 !!end
397
398
399 !! test
400 Italics and bold: 2-quote opening sequence: (2,4)
401 !! input
402 ''foo''''
403 !! result
404 <p><i>foo''</i>
405 </p>
406 !!end
407
408
409 !! test
410 Italics and bold: 2-quote opening sequence: (2,5) (php)
411 !! options
412 php
413 !! input
414 ''foo'''''
415 !! result
416 <p><i>foo</i>
417 </p>
418 !!end
419 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
420 !! test
421 Italics and bold: 2-quote opening sequence: (2,5) (parsoid)
422 !! options
423 parsoid
424 !! input
425 ''foo'''''
426 !! result
427 <p><i>foo</i><b></b>
428 </p>
429 !!end
430
431
432 ###
433 ### 3-quote opening sequence tests
434 ###
435
436 !! test
437 Italics and bold: 3-quote opening sequence: (3,2)
438 !! input
439 '''foo''
440 !! result
441 <p>'<i>foo</i>
442 </p>
443 !!end
444
445
446 !! test
447 Italics and bold: 3-quote opening sequence: (3,3)
448 !! input
449 '''foo'''
450 !! result
451 <p><b>foo</b>
452 </p>
453 !!end
454
455
456 !! test
457 Italics and bold: 3-quote opening sequence: (3,4)
458 !! input
459 '''foo''''
460 !! result
461 <p><b>foo'</b>
462 </p>
463 !!end
464
465
466 !! test
467 Italics and bold: 3-quote opening sequence: (3,5) (php)
468 !! options
469 php
470 !! input
471 '''foo'''''
472 !! result
473 <p><b>foo</b>
474 </p>
475 !!end
476 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
477 !! test
478 Italics and bold: 3-quote opening sequence: (3,5) (parsoid)
479 !! options
480 parsoid
481 !! input
482 '''foo'''''
483 !! result
484 <p><b>foo<i></i></b>
485 </p>
486 !!end
487
488
489 ###
490 ### 4-quote opening sequence tests
491 ###
492
493 !! test
494 Italics and bold: 4-quote opening sequence: (4,2)
495 !! input
496 ''''foo''
497 !! result
498 <p>''<i>foo</i>
499 </p>
500 !!end
501
502
503 !! test
504 Italics and bold: 4-quote opening sequence: (4,3)
505 !! input
506 ''''foo'''
507 !! result
508 <p>'<b>foo</b>
509 </p>
510 !!end
511
512
513 !! test
514 Italics and bold: 4-quote opening sequence: (4,4)
515 !! input
516 ''''foo''''
517 !! result
518 <p>'<b>foo'</b>
519 </p>
520 !!end
521
522
523 !! test
524 Italics and bold: 4-quote opening sequence: (4,5) (php)
525 !! options
526 php
527 !! input
528 ''''foo'''''
529 !! result
530 <p>'<b>foo</b>
531 </p>
532 !!end
533 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
534 !! test
535 Italics and bold: 4-quote opening sequence: (4,5) (parsoid)
536 !! options
537 parsoid
538 !! input
539 ''''foo'''''
540 !! result
541 <p>'<b>foo<i></i></b>
542 </p>
543 !!end
544
545
546 ###
547 ### 5-quote opening sequence tests
548 ###
549
550 !! test
551 Italics and bold: 5-quote opening sequence: (5,2) (php)
552 !! options
553 php
554 !! input
555 '''''foo''
556 !! result
557 <p><b><i>foo</i></b>
558 </p>
559 !!end
560 # Parsoid reverses the nesting order, compared to the PHP parser
561 !! test
562 Italics and bold: 5-quote opening sequence: (5,2) (parsoid)
563 !! options
564 parsoid
565 !! input
566 '''''foo''
567 !! result
568 <p><i><b>foo</b></i>
569 </p>
570 !!end
571
572
573 !! test
574 Italics and bold: 5-quote opening sequence: (5,3)
575 !! input
576 '''''foo'''
577 !! result
578 <p><i><b>foo</b></i>
579 </p>
580 !!end
581
582
583 !! test
584 Italics and bold: 5-quote opening sequence: (5,4)
585 !! input
586 '''''foo''''
587 !! result
588 <p><i><b>foo'</b></i>
589 </p>
590 !!end
591
592
593 !! test
594 Italics and bold: 5-quote opening sequence: (5,5)
595 !! input
596 '''''foo'''''
597 !! result
598 <p><i><b>foo</b></i>
599 </p>
600 !!end
601
602 ###
603 ### multiple quote sequences in a line
604 ###
605 !! test
606 Italics and bold: multiple quote sequences: (2,4,2)
607 !! input
608 ''foo''''bar''
609 !! result
610 <p><i>foo'<b>bar</b></i>
611 </p>
612 !!end
613
614
615 !! test
616 Italics and bold: multiple quote sequences: (2,4,3)
617 !! input
618 ''foo''''bar'''
619 !! result
620 <p><i>foo'<b>bar</b></i>
621 </p>
622 !!end
623
624
625 !! test
626 Italics and bold: multiple quote sequences: (2,4,4)
627 !! input
628 ''foo''''bar''''
629 !! result
630 <p><i>foo'<b>bar'</b></i>
631 </p>
632 !!end
633
634
635 !! test
636 Italics and bold: multiple quote sequences: (3,4,2) (php)
637 !! options
638 php
639 !! input
640 '''foo''''bar''
641 !! result
642 <p><b>foo'</b>bar
643 </p>
644 !!end
645 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
646 !! test
647 Italics and bold: multiple quote sequences: (3,4,2) (parsoid)
648 !! options
649 parsoid
650 !! input
651 '''foo''''bar''
652 !! result
653 <p><b>foo'</b>bar<i></i>
654 </p>
655 !!end
656
657
658 !! test
659 Italics and bold: multiple quote sequences: (3,4,3) (php)
660 !! options
661 php
662 !! input
663 '''foo''''bar'''
664 !! result
665 <p><b>foo'</b>bar
666 </p>
667 !!end
668 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
669 !! test
670 Italics and bold: multiple quote sequences: (3,4,3) (parsoid)
671 !! options
672 parsoid
673 !! input
674 '''foo''''bar'''
675 !! result
676 <p><b>foo'</b>bar<b></b>
677 </p>
678 !!end
679
680 ###
681 ### other quote tests
682 ###
683 !! test
684 Italics and bold: other quote tests: (2,3,5)
685 !! input
686 ''this is about '''foo's family'''''
687 !! result
688 <p><i>this is about <b>foo's family</b></i>
689 </p>
690 !!end
691
692
693 !! test
694 Italics and bold: other quote tests: (2,(3,3),2)
695 !! input
696 ''this is about '''foo's''' family''
697 !! result
698 <p><i>this is about <b>foo's</b> family</i>
699 </p>
700 !!end
701
702
703 !! test
704 Italics and bold: other quote tests: (3,2,3,2)
705 !! input
706 '''this is about ''foo'''s family''
707 !! result
708 <p><b>this is about <i>foo</i></b><i>s family</i>
709 </p>
710 !!end
711
712
713 # The Parsoid team believes the PHP parser's output on this test is wrong.
714 # It only checks for convert-to-bold-on-single-character-word when the word
715 # matches with a bold tag ("'''") that is *odd* in the list of quote tokens.
716 # This means that the bold token in position 2 (0-indexed) gets converted by
717 # parsoid, but doesn't get changed by the PHP parser.
718 !! test
719 Italics and bold: other quote tests: (3,2,3,3) (php)
720 !! options
721 php
722 !! input
723 '''this is about ''foo'''s family'''
724 !! result
725 <p>'<i>this is about </i>foo<b>s family</b>
726 </p>
727 !!end
728 # This is the output the Parsoid team believes to be correct.
729 !! test
730 Italics and bold: other quote tests: (3,2,3,3) (parsoid)
731 !! options
732 parsoid
733 !! input
734 '''this is about ''foo'''s family'''
735 !! result
736 <p><b>this is about <i>foo'</i>s family</b>
737 </p>
738 !!end
739
740
741 !! test
742 Italics and bold: other quote tests: (3,(2,2),3)
743 !! input
744 '''this is about ''foo's'' family'''
745 !! result
746 <p><b>this is about <i>foo's</i> family</b>
747 </p>
748 !!end
749
750
751 !! test
752 Italicized possessive
753 !! input
754 The ''[[Main Page]]'''s talk page.
755 !! result
756 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
757 </p>
758 !! end
759
760 ###
761 ### Non-html5 tags
762 ###
763
764 !! test
765 Non-html5 tags should be accepted
766 !! input
767 <center>''foo''</center>
768 <big>''foo''</big>
769 <font>''foo''</font>
770 <strike>''foo''</strike>
771 <tt>''foo''</tt>
772 !! result
773 <center><i>foo</i></center>
774 <p><big><i>foo</i></big>
775 <font><i>foo</i></font>
776 <strike><i>foo</i></strike>
777 <tt><i>foo</i></tt>
778 </p>
779 !! end
780
781 ###
782 ### <nowiki> test cases
783 ###
784
785 !! test
786 <nowiki> unordered list
787 !! input
788 <nowiki>* This is not an unordered list item.</nowiki>
789 !! result
790 <p>* This is not an unordered list item.
791 </p>
792 !! end
793
794 !! test
795 <nowiki> spacing
796 !! input
797 <nowiki>Lorem ipsum dolor
798
799 sed abit.
800 sed nullum.
801
802 :and a colon
803 </nowiki>
804 !! result
805 <p>Lorem ipsum dolor
806
807 sed abit.
808 sed nullum.
809
810 :and a colon
811
812 </p>
813 !! end
814
815 !! test
816 nowiki 3
817 !! input
818 :There is not nowiki.
819 :There is <nowiki>nowiki</nowiki>.
820
821 #There is not nowiki.
822 #There is <nowiki>nowiki</nowiki>.
823
824 *There is not nowiki.
825 *There is <nowiki>nowiki</nowiki>.
826 !! result
827 <dl><dd>There is not nowiki.
828 </dd><dd>There is nowiki.
829 </dd></dl>
830 <ol><li>There is not nowiki.
831 </li><li>There is nowiki.
832 </li></ol>
833 <ul><li>There is not nowiki.
834 </li><li>There is nowiki.
835 </li></ul>
836
837 !! end
838
839 !! test
840 Entities inside <nowiki>
841 !! input
842 <nowiki>&lt;</nowiki>
843 !! result
844 <p>&lt;
845 </p>
846 !! end
847
848
849 ###
850 ### Comments
851 ###
852 !! test
853 Comments and Indent-Pre
854 !! input
855 <!-- comment 1 --> asdf
856
857 <!-- comment 1 --> asdf
858 <!-- comment 2 -->
859
860 <!-- comment 1 --> asdf
861 <!-- comment 2 -->xyz
862
863 <!-- comment 1 --> asdf
864 <!-- comment 2 --> xyz
865 !! result
866 <pre>asdf
867 </pre>
868 <pre>asdf
869 </pre>
870 <pre>asdf
871 </pre>
872 <p>xyz
873 </p>
874 <pre>asdf
875 xyz
876 </pre>
877 !! end
878
879 !! test
880 Comment test 2a
881 !! input
882 asdf
883 <!-- comment 1 -->
884 jkl
885 !! result
886 <p>asdf
887 jkl
888 </p>
889 !! end
890
891 !! test
892 Comment test 2b
893 !! input
894 asdf
895 <!-- comment 1 -->
896
897 jkl
898 !! result
899 <p>asdf
900 </p><p>jkl
901 </p>
902 !! end
903
904 !! test
905 Comment test 3
906 !! input
907 asdf
908 <!-- comment 1 -->
909 <!-- comment 2 -->
910 jkl
911 !! result
912 <p>asdf
913 jkl
914 </p>
915 !! end
916
917 !! test
918 Comment test 4
919 !! input
920 asdf<!-- comment 1 -->jkl
921 !! result
922 <p>asdfjkl
923 </p>
924 !! end
925
926 !! test
927 Comment spacing
928 !! input
929 a
930 <!-- foo --> b <!-- bar -->
931 c
932 !! result
933 <p>a
934 </p>
935 <pre> b
936 </pre>
937 <p>c
938 </p>
939 !! end
940
941 !! test
942 Comment whitespace
943 !! input
944 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
945 !! result
946
947 !! end
948
949 !! test
950 Comment semantics and delimiters
951 !! input
952 <!-- --><!----><!-----><!------>
953 !! result
954
955 !! end
956
957 !! test
958 Comment semantics and delimiters, redux
959 !! input
960 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
961 -- foo -- funky huh? ... -->
962 !! result
963
964 !! end
965
966 !! test
967 Comment semantics and delimiters: directors cut
968 !! input
969 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
970 everything starting with < followed by !-- until the first -- and > we see,
971 that wouldn't be valid XML however, since in XML -- has to terminate a comment
972 -->-->
973 !! result
974 <p>--&gt;
975 </p>
976 !! end
977
978 !! test
979 Comment semantics: nesting
980 !! input
981 <!--<!-- no, we're not going to do anything fancy here -->-->
982 !! result
983 <p>--&gt;
984 </p>
985 !! end
986
987 !! test
988 Comment semantics: unclosed comment at end
989 !! input
990 <!--This comment will run out to the end of the document
991 !! result
992
993 !! end
994
995 !! test
996 Comment in template title
997 !! input
998 {{f<!---->oo}}
999 !! result
1000 <p>FOO
1001 </p>
1002 !! end
1003
1004 !! test
1005 Comment on its own line post-expand
1006 !! input
1007 a
1008 {{blank}}<!---->
1009 b
1010 !! result
1011 <p>a
1012 </p><p>b
1013 </p>
1014 !! end
1015
1016 !! test
1017 Comment on its own line post-expand with non-significant whitespace
1018 !! input
1019 a
1020 {{blank}} <!---->
1021 b
1022 !! result
1023 <p>a
1024 </p><p>b
1025 </p>
1026 !! end
1027
1028 ###
1029 ### paragraph wraping tests
1030 ###
1031 !! test
1032 No block tags
1033 !! input
1034 a
1035
1036 b
1037 !! result
1038 <p>a
1039 </p><p>b
1040 </p>
1041 !! end
1042 !! test
1043 Block tag on one line
1044 !! input
1045 a <div>foo</div>
1046
1047 b
1048 !! result
1049 a <div>foo</div>
1050 <p>b
1051 </p>
1052 !! end
1053
1054 !! test
1055 Block tag on both lines
1056 !! input
1057 a <div>foo</div>
1058
1059 b <div>foo</div>
1060 !! result
1061 a <div>foo</div>
1062 b <div>foo</div>
1063
1064 !! end
1065
1066 !! test
1067 Multiple lines without block tags
1068 !! input
1069 <div>foo</div> a
1070 b
1071 c
1072 d<!--foo--> e
1073 x <div>foo</div> z
1074 !! result
1075 <div>foo</div> a
1076 <p>b
1077 c
1078 d e
1079 </p>
1080 x <div>foo</div> z
1081
1082 !! end
1083
1084 !! test
1085 Empty lines between lines with block tags
1086 !! input
1087 <div></div>
1088
1089
1090 <div></div>a
1091
1092 b
1093 <div>a</div>b
1094
1095 <div>b</div>d
1096
1097
1098 <div>e</div>
1099 !! result
1100 <div></div>
1101 <p><br />
1102 </p>
1103 <div></div>a
1104 <p>b
1105 </p>
1106 <div>a</div>b
1107 <div>b</div>d
1108 <p><br />
1109 </p>
1110 <div>e</div>
1111
1112 !! end
1113
1114 ###
1115 ### Preformatted text
1116 ###
1117 !! test
1118 Preformatted text
1119 !! input
1120 This is some
1121 Preformatted text
1122 With ''italic''
1123 And '''bold'''
1124 And a [[Main Page|link]]
1125 !! result
1126 <pre>This is some
1127 Preformatted text
1128 With <i>italic</i>
1129 And <b>bold</b>
1130 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
1131 </pre>
1132 !! end
1133
1134 !! test
1135 Ident preformatting with inline content
1136 !! input
1137 a
1138 ''b''
1139 !! result
1140 <pre>a
1141 <i>b</i>
1142 </pre>
1143 !! end
1144
1145 !! test
1146 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
1147 !! input
1148 <pre><nowiki>
1149 <b>
1150 <cite>
1151 <em>
1152 </nowiki></pre>
1153 !! result
1154 <pre>
1155 &lt;b&gt;
1156 &lt;cite&gt;
1157 &lt;em&gt;
1158 </pre>
1159
1160 !! end
1161
1162 !! test
1163 Regression with preformatted in <center>
1164 !! input
1165 <center>
1166 Blah
1167 </center>
1168 !! result
1169 <center>
1170 <pre>Blah
1171 </pre>
1172 </center>
1173
1174 !! end
1175
1176 # Expected output in the following test is not really expected (there should be
1177 # <pre> in the output) -- it's only testing for well-formedness.
1178 !! test
1179 Bug 6200: Preformatted in <blockquote>
1180 !! input
1181 <blockquote>
1182 Blah
1183 </blockquote>
1184 !! result
1185 <blockquote>
1186 Blah
1187 </blockquote>
1188
1189 !! end
1190
1191 !! test
1192 <pre> with attributes (bug 3202)
1193 !! input
1194 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1195 !! result
1196 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1197
1198 !! end
1199
1200 !! test
1201 <pre> with width attribute (bug 3202)
1202 !! input
1203 <pre width="8">Narrow screen goodies</pre>
1204 !! result
1205 <pre width="8">Narrow screen goodies</pre>
1206
1207 !! end
1208
1209 !! test
1210 <pre> with forbidden attribute (bug 3202)
1211 !! input
1212 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
1213 !! result
1214 <pre width="8">Narrow screen goodies</pre>
1215
1216 !! end
1217
1218 !! test
1219 Entities inside <pre>
1220 !! input
1221 <pre>&lt;</pre>
1222 !! result
1223 <pre>&lt;</pre>
1224
1225 !! end
1226
1227 !! test
1228 <pre> with forbidden attribute values (bug 3202)
1229 !! input
1230 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
1231 !! result
1232 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
1233
1234 !! end
1235
1236 !! test
1237 <nowiki> inside <pre> (bug 13238)
1238 !! input
1239 <pre>
1240 <nowiki>
1241 </pre>
1242 <pre>
1243 <nowiki></nowiki>
1244 </pre>
1245 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
1246 !! result
1247 <pre>
1248 &lt;nowiki&gt;
1249 </pre>
1250 <pre>
1251
1252 </pre>
1253 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
1254
1255 !! end
1256
1257 !! test
1258 <nowiki> and <pre> preference (first one wins)
1259 !! input
1260 <pre>
1261 <nowiki>
1262 </pre>
1263 </nowiki>
1264 </pre>
1265
1266 <nowiki>
1267 <pre>
1268 <nowiki>
1269 </pre>
1270 </nowiki>
1271 </pre>
1272
1273 !! result
1274 <pre>
1275 &lt;nowiki&gt;
1276 </pre>
1277 <p>&lt;/nowiki&gt;
1278 &lt;/pre&gt;
1279 </p><p>
1280 &lt;pre&gt;
1281 &lt;nowiki&gt;
1282 &lt;/pre&gt;
1283
1284 &lt;/pre&gt;
1285 </p>
1286 !! end
1287
1288 !! test
1289 </pre> inside nowiki
1290 !! input
1291 <nowiki></pre></nowiki>
1292 !! result
1293 <p>&lt;/pre&gt;
1294 </p>
1295 !! end
1296
1297 !!test
1298 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
1299 !!input
1300 {{echo|}}
1301 !!result
1302
1303 !!end
1304
1305 !!test
1306 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
1307 !!input
1308 {{echo|
1309 foo}}
1310 !!result
1311 <p>foo
1312 </p>
1313 !!end
1314
1315 !! test
1316 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
1317 !! input
1318 {{echo|a
1319 b}}
1320 !!result
1321 <pre>a
1322 </pre>
1323 <p>b
1324 </p>
1325 !!end
1326
1327 !! test
1328 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
1329 !! input
1330 {{echo|a
1331 b
1332 c
1333 d
1334 e
1335 }}
1336 !!result
1337 <pre>a
1338 </pre>
1339 <p>b
1340 c
1341 </p>
1342 <pre>d
1343 </pre>
1344 <p>e
1345 </p>
1346 !!end
1347
1348 !!test
1349 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
1350 !!input
1351 {{echo| foo}}
1352
1353 {{echo| foo}}{{echo| bar}}
1354
1355 {{echo| foo}}
1356 {{echo| bar}}
1357
1358 {{echo|<!--cmt--> foo}}
1359
1360 <!--cmt-->{{echo| foo}}
1361
1362 {{echo|{{echo| }}bar}}
1363 !!result
1364 <pre>foo
1365 </pre>
1366 <pre>foo bar
1367 </pre>
1368 <pre>foo
1369 bar
1370 </pre>
1371 <pre>foo
1372 </pre>
1373 <pre>foo
1374 </pre>
1375 <pre>bar
1376 </pre>
1377 !!end
1378
1379 !! test
1380 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
1381 !! input
1382 {{echo| }}a
1383
1384 {{echo|
1385 }}a
1386
1387 {{echo|
1388 b}}
1389
1390 {{echo|a
1391 }}b
1392
1393 {{echo|a
1394 }} b
1395 !!result
1396 <pre>a
1397 </pre>
1398 <p><br />
1399 </p>
1400 <pre>a
1401 </pre>
1402 <p><br />
1403 </p>
1404 <pre>b
1405 </pre>
1406 <p>a
1407 </p>
1408 <pre>b
1409 </pre>
1410 <p>a
1411 </p>
1412 <pre>b
1413 </pre>
1414 !!end
1415
1416 !! test
1417 Templates: Single-line variant of parameter whitespace stripping test
1418 !! input
1419 {{echo| a}}
1420
1421 {{echo|1= a}}
1422
1423 {{echo|{{echo| a}}}}
1424
1425 {{echo|1={{echo| a}}}}
1426 !! result
1427 <pre>a
1428 </pre>
1429 <p>a
1430 </p>
1431 <pre>a
1432 </pre>
1433 <p>a
1434 </p>
1435 !! end
1436
1437 !! test
1438 Templates: Strip whitespace from named parameters, but not positional ones
1439 !! input
1440 {{echo|
1441 foo}}
1442
1443 {{echo|
1444 * foo}}
1445
1446 {{echo| 1 =
1447 foo}}
1448
1449 {{echo| 1 =
1450 * foo}}
1451 !! result
1452 <pre>foo
1453 </pre>
1454 <p><br />
1455 </p>
1456 <ul><li> foo
1457 </li></ul>
1458 <p>foo
1459 </p>
1460 <ul><li> foo
1461 </li></ul>
1462
1463 !! end
1464
1465 ###
1466 ### Parsoid-centric tests for testing RT edge cases for pre
1467 ###
1468
1469 !!test
1470 1a. Indent-Pre and Comments
1471 !!input
1472 a
1473 <!--a-->
1474 c
1475 !!result
1476 <pre>a
1477 </pre>
1478 <p>c
1479 </p>
1480 !!end
1481
1482 !!test
1483 1b. Indent-Pre and Comments
1484 !!input
1485 a
1486 <!--a-->
1487 c
1488 !!result
1489 <pre>a
1490 </pre>
1491 <p>c
1492 </p>
1493 !!end
1494
1495 !!test
1496 1c. Indent-Pre and Comments
1497 !!input
1498 <!--a--> a
1499
1500 <!--a--> a
1501 !!result
1502 <pre> a
1503 </pre>
1504 <pre> a
1505 </pre>
1506 !!end
1507
1508 !!test
1509 2a. Indent-Pre and tables
1510 !!input
1511 {|
1512 |-
1513 !h1!!h2
1514 |foo||bar
1515 |}
1516 !!result
1517 <table>
1518
1519 <tr>
1520 <th>h1</th>
1521 <th>h2
1522 </th>
1523 <td>foo</td>
1524 <td>bar
1525 </td></tr></table>
1526
1527 !!end
1528
1529 !!test
1530 2b. Indent-Pre and tables
1531 !!input
1532 {|
1533 |-
1534 |foo
1535 |}
1536 !!result
1537 <table>
1538
1539 <tr>
1540 <td>foo
1541 </td></tr></table>
1542
1543 !!end
1544
1545 !!test
1546 2c. Indent-Pre and tables (bug 42252)
1547 !!input
1548 {|
1549 |+ foo
1550 ! | bar
1551 |}
1552 !!result
1553 <table>
1554 <caption> foo
1555 </caption>
1556 <tr>
1557 <th> bar
1558 </th></tr></table>
1559
1560 !!end
1561
1562 !!test
1563 3a. Indent-Pre and block tags (single-line html)
1564 !!input
1565 <p> foo </p>
1566 <div> foo </div>
1567 <span> foo </span>
1568 !!result
1569 <p> foo </p>
1570 <div> foo </div>
1571 <pre><span> foo </span>
1572 </pre>
1573 !!end
1574
1575 !!test
1576 3b. Indent-Pre and block tags (pre-content on separate line)
1577 !!input
1578 <p>
1579 foo
1580 </p>
1581
1582 <div>
1583 foo
1584 </div>
1585
1586 <center>
1587 foo
1588 </center>
1589
1590 <blockquote>
1591 foo
1592 </blockquote>
1593
1594 <table><tr><td>
1595 foo
1596 </td></tr></table>
1597
1598 <ul><li>
1599 foo
1600 </li></ul>
1601
1602 !!result
1603 <p>
1604 foo
1605 </p>
1606 <div>
1607 <pre>foo
1608 </pre>
1609 </div>
1610 <center>
1611 <pre>foo
1612 </pre>
1613 </center>
1614 <blockquote>
1615 foo
1616 </blockquote>
1617 <table><tr><td>
1618 <pre>foo
1619 </pre>
1620 </td></tr></table>
1621 <ul><li>
1622 foo
1623 </li></ul>
1624
1625 !!end
1626
1627 !!test
1628 4. Multiple spaces at start-of-line
1629 !!input
1630 <p> foo </p>
1631 foo
1632 {|
1633 |foo
1634 |}
1635 !!result
1636 <p> foo </p>
1637 <pre> foo
1638 </pre>
1639 <table>
1640 <tr>
1641 <td>foo
1642 </td></tr></table>
1643
1644 !!end
1645
1646 !! test
1647 5. White-space in indent-pre
1648 NOTE: the white-space char on 2nd line is significant
1649 !! input
1650 a<br/>
1651
1652 b
1653 !! result
1654 <pre>a<br />
1655
1656 b
1657 </pre>
1658 !! end
1659
1660 ###
1661 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
1662 ###
1663
1664 !!test
1665 HTML-pre: 1. embedded newlines
1666 !!input
1667 <pre>foo</pre>
1668
1669 <pre>
1670 foo
1671 </pre>
1672
1673 <pre>
1674
1675 foo
1676 </pre>
1677
1678 <pre>
1679
1680
1681 foo
1682 </pre>
1683 !!result
1684 <pre>foo</pre>
1685 <pre>
1686 foo
1687 </pre>
1688 <pre>
1689
1690 foo
1691 </pre>
1692 <pre>
1693
1694
1695 foo
1696 </pre>
1697
1698 !!end
1699
1700 !!test
1701 HTML-pre: 2: indented text
1702 !!input
1703 <pre>
1704 foo
1705 </pre>
1706 !!result
1707 <pre>
1708 foo
1709 </pre>
1710
1711 !!end
1712
1713 !!test
1714 HTML-pre: 3: other wikitext
1715 !!input
1716 <pre>
1717 * foo
1718 # bar
1719 = no-h =
1720 '' no-italic ''
1721 [[ NoLink ]]
1722 </pre>
1723 !!result
1724 <pre>
1725 * foo
1726 # bar
1727 = no-h =
1728 '' no-italic ''
1729 [[ NoLink ]]
1730 </pre>
1731
1732 !!end
1733
1734 ###
1735 ### Definition lists
1736 ###
1737 !! test
1738 Simple definition
1739 !! input
1740 ; name : Definition
1741 !! result
1742 <dl><dt> name&#160;</dt><dd> Definition
1743 </dd></dl>
1744
1745 !! end
1746
1747 !! test
1748 Definition list for indentation only
1749 !! input
1750 : Indented text
1751 !! result
1752 <dl><dd> Indented text
1753 </dd></dl>
1754
1755 !! end
1756
1757 !! test
1758 Definition list with no space
1759 !! input
1760 ;name:Definition
1761 !! result
1762 <dl><dt>name</dt><dd>Definition
1763 </dd></dl>
1764
1765 !!end
1766
1767 !! test
1768 Definition list with URL link
1769 !! input
1770 ; http://example.com/ : definition
1771 !! result
1772 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt><dd> definition
1773 </dd></dl>
1774
1775 !! end
1776
1777 !! test
1778 Definition list with bracketed URL link
1779 !! input
1780 ;[http://www.example.com/ Example]:Something about it
1781 !! result
1782 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt><dd>Something about it
1783 </dd></dl>
1784
1785 !! end
1786
1787 !! test
1788 Definition list with wikilink containing colon
1789 !! input
1790 ; [[Help:FAQ]]: The least-read page on Wikipedia
1791 !! result
1792 <dl><dt> <a href="/index.php?title=Help:FAQ&amp;action=edit&amp;redlink=1" class="new" title="Help:FAQ (page does not exist)">Help:FAQ</a></dt><dd> The least-read page on Wikipedia
1793 </dd></dl>
1794
1795 !! end
1796
1797 # At Brion's and JeLuF's insistence... :)
1798 !! test
1799 Definition list with news link containing colon
1800 !! input
1801 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
1802 !! result
1803 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt><dd> This isn't even a real newsgroup!
1804 </dd></dl>
1805
1806 !! end
1807
1808 !! test
1809 Malformed definition list with colon
1810 !! input
1811 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
1812 !! result
1813 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a> -- don't crash or enter an infinite loop
1814 </dt></dl>
1815
1816 !! end
1817
1818 !! test
1819 Definition lists: colon in external link text
1820 !! input
1821 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
1822 !! result
1823 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt><dd> OK, I made that up
1824 </dd></dl>
1825
1826 !! end
1827
1828 !! test
1829 Definition lists: colon in HTML attribute
1830 !! input
1831 ;<b style="display: inline">bold</b>
1832 !! result
1833 <dl><dt><b style="display: inline">bold</b>
1834 </dt></dl>
1835
1836 !! end
1837
1838 !! test
1839 Definition lists: self-closed tag
1840 !! input
1841 ;one<br/>two : two-line fun
1842 !! result
1843 <dl><dt>one<br />two&#160;</dt><dd> two-line fun
1844 </dd></dl>
1845
1846 !! end
1847
1848 !! test
1849 Bug 11748: Literal closing tags
1850 !! input
1851 <dl>
1852 <dt>test 1</dt>
1853 <dd>test test test test test</dd>
1854 <dt>test 2</dt>
1855 <dd>test test test test test</dd>
1856 </dl>
1857 !! result
1858 <dl>
1859 <dt>test 1</dt>
1860 <dd>test test test test test</dd>
1861 <dt>test 2</dt>
1862 <dd>test test test test test</dd>
1863 </dl>
1864
1865 !! end
1866
1867 !! test
1868 Definition and unordered list using wiki syntax nested in unordered list using html tags.
1869 !! input
1870 <ul><li>
1871 ; term : description
1872 * unordered
1873 </li>
1874 </ul>
1875 !! result
1876 <ul><li>
1877 <dl><dt> term&#160;</dt><dd> description
1878 </dd></dl>
1879 <ul><li> unordered
1880 </li></ul>
1881 </li>
1882 </ul>
1883
1884 !! end
1885
1886 !! test
1887
1888 Definition list with empty definition and following paragraph
1889 !! input
1890 ; term:
1891 Paragraph text
1892 !! result
1893 <dl><dt> term</dt><dd>
1894 </dd></dl>
1895 <p>Paragraph text
1896 </p>
1897 !! end
1898
1899 !! test
1900 Nested definition lists using html syntax
1901 !! input
1902 <dl><dd>
1903 <dl>
1904 <dd>Foo</dd>
1905 </dl>
1906 </dd></dl>
1907 !! result
1908 <dl><dd>
1909 <dl>
1910 <dd>Foo</dd>
1911 </dl>
1912 </dd></dl>
1913
1914 !! end
1915
1916 !! test
1917 Definition Lists: No nesting: Multiple dd's
1918 !! input
1919 ;x
1920 :a
1921 :b
1922 !! result
1923 <dl><dt>x
1924 </dt><dd>a
1925 </dd><dd>b
1926 </dd></dl>
1927
1928 !! end
1929
1930 !! test
1931 Definition Lists: Indentation: Regular
1932 !! input
1933 :i1
1934 ::i2
1935 :::i3
1936 !! result
1937 <dl><dd>i1
1938 <dl><dd>i2
1939 <dl><dd>i3
1940 </dd></dl>
1941 </dd></dl>
1942 </dd></dl>
1943
1944 !! end
1945
1946 !! test
1947 Definition Lists: Indentation: Missing 1st level
1948 !! input
1949 ::i2
1950 :::i3
1951 !! result
1952 <dl><dd><dl><dd>i2
1953 <dl><dd>i3
1954 </dd></dl>
1955 </dd></dl>
1956 </dd></dl>
1957
1958 !! end
1959
1960 !! test
1961 Definition Lists: Indentation: Multi-level indent
1962 !! input
1963 :::i3
1964 !! result
1965 <dl><dd><dl><dd><dl><dd>i3
1966 </dd></dl>
1967 </dd></dl>
1968 </dd></dl>
1969
1970 !! end
1971
1972 !! test
1973 Definition Lists: Hacky use to indent tables
1974 !! input
1975 ::{|
1976 |foo
1977 |bar
1978 |}
1979 this text
1980 should be left alone
1981 !! result
1982 <dl><dd><dl><dd><table>
1983 <tr>
1984 <td>foo
1985 </td>
1986 <td>bar
1987 </td></tr></table></dd></dl></dd></dl>
1988 <p>this text
1989 should be left alone
1990 </p>
1991 !! end
1992 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
1993 ## as an empty dt item. It also ignores all but the last ";" when followed
1994 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
1995 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
1996 ## ";"s.
1997 ##
1998 ## Ex: ";;t2 ::d2" is transformed into:
1999 ##
2000 ## <dl>
2001 ## <dt>t2 </dt>
2002 ## <dd>
2003 ## <dl>
2004 ## <dt></dt>
2005 ## <dd>d2</dd>
2006 ## </dl>
2007 ## </dd>
2008 ## </dl>
2009 ##
2010 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
2011 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
2012 ##
2013 ## <dl>
2014 ## <dt>
2015 ## <dl>
2016 ## <dt>t2 </dt>
2017 ## <dd>:d2</dd>
2018 ## </dl>
2019 ## </dt>
2020 ## </dl>
2021 ##
2022 ## All Parsoid only definition list tests have this difference.
2023 ##
2024 ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569
2025 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
2026
2027 !! test
2028 Table / list interaction: indented table with lists in table contents
2029 !! input
2030 :{|
2031 |-
2032 | a
2033 * b
2034 |-
2035 | c
2036 * d
2037 |}
2038 !! result
2039 <dl><dd><table>
2040
2041 <tr>
2042 <td> a
2043 <ul><li> b
2044 </li></ul>
2045 </td></tr>
2046 <tr>
2047 <td> c
2048 <ul><li> d
2049 </li></ul>
2050 </td></tr></table></dd></dl>
2051
2052 !! end
2053
2054 !!test
2055 Table / list interaction: lists nested in tables nested in indented lists
2056 !!input
2057 :{|
2058 |
2059 :a
2060 :b
2061 |
2062 *c
2063 *d
2064 |}
2065
2066 *e
2067 *f
2068 !!result
2069 <dl><dd><table>
2070 <tr>
2071 <td>
2072 <dl><dd>a
2073 </dd><dd>b
2074 </dd></dl>
2075 </td>
2076 <td>
2077 <ul><li>c
2078 </li><li>d
2079 </li></ul>
2080 </td></tr></table></dd></dl>
2081 <ul><li>e
2082 </li><li>f
2083 </li></ul>
2084
2085 !!end
2086
2087 !! test
2088 Definition Lists: Nesting: Multi-level (Parsoid only)
2089 !! options
2090 parsoid
2091 !! input
2092 ;t1 :d1
2093 ;;t2 ::d2
2094 ;;;t3 :::d3
2095 !! result
2096 <dl>
2097 <dt>t1 </dt>
2098 <dd>d1</dd>
2099 <dt>
2100 <dl>
2101 <dt>t2 </dt>
2102 <dd>:d2</dd>
2103 <dt>
2104 <dl>
2105 <dt>t3 </dt>
2106 <dd>::d3</dd>
2107 </dl>
2108 </dt>
2109 </dl>
2110 </dt>
2111 </dl>
2112
2113
2114 !! end
2115
2116
2117 !! test
2118 Definition Lists: Nesting: Test 2 (Parsoid only)
2119 !! options
2120 parsoid
2121 !! input
2122 ;t1
2123 ::d2
2124 !! result
2125 <dl>
2126 <dt>t1</dt>
2127 <dd>
2128 <dl>
2129 <dd>d2</dd>
2130 </dl>
2131 </dd>
2132 </dl>
2133
2134 !! end
2135
2136
2137 !! test
2138 Definition Lists: Nesting: Test 3 (Parsoid only)
2139 !! options
2140 parsoid
2141 !! input
2142 :;t1
2143 ::::d2
2144 !! result
2145 <dl>
2146 <dd>
2147 <dl>
2148 <dt>t1</dt>
2149 <dd>
2150 <dl>
2151 <dd>
2152 <dl>
2153 <dd>d2</dd>
2154 </dl>
2155 </dd>
2156 </dl>
2157 </dd>
2158 </dl>
2159 </dd>
2160 </dl>
2161
2162 !! end
2163
2164
2165 !! test
2166 Definition Lists: Nesting: Test 4
2167 !! input
2168 ::;t3
2169 :::d3
2170 !! result
2171 <dl><dd><dl><dd><dl><dt>t3
2172 </dt><dd>d3
2173 </dd></dl>
2174 </dd></dl>
2175 </dd></dl>
2176
2177 !! end
2178
2179
2180 ## The Parsoid team believes the following three test exposes a
2181 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
2182 ## wrong to close the <dl> after the <dt> containing the <ul>.)
2183 !! test
2184 Definition Lists: Mixed Lists: Test 1 (php)
2185 !! options
2186 php
2187 !! input
2188 :;* foo
2189 ::* bar
2190 :; baz
2191 !! result
2192 <dl><dd><dl><dt><ul><li> foo
2193 </li><li> bar
2194 </li></ul>
2195 </dt></dl>
2196 <dl><dt> baz
2197 </dt></dl>
2198 </dd></dl>
2199
2200 !! end
2201 !! test
2202 Definition Lists: Mixed Lists: Test 1 (parsoid)
2203 !! options
2204 parsoid
2205 !! input
2206 :;* foo
2207 ::* bar
2208 :; baz
2209 !! result
2210 <dl><dd><dl><dt><ul><li> foo
2211 </li></ul></dt><dd><ul><li> bar
2212 </li></ul></dd><dt> baz</dt></dl></dd></dl>
2213 !! end
2214
2215 !! test
2216 Definition Lists: Mixed Lists: Test 2
2217 !! input
2218 *: d1
2219 *: d2
2220 !! result
2221 <ul><li><dl><dd> d1
2222 </dd><dd> d2
2223 </dd></dl>
2224 </li></ul>
2225
2226 !! end
2227
2228
2229 !! test
2230 Definition Lists: Mixed Lists: Test 3
2231 !! input
2232 *::: d1
2233 *::: d2
2234 !! result
2235 <ul><li><dl><dd><dl><dd><dl><dd> d1
2236 </dd><dd> d2
2237 </dd></dl>
2238 </dd></dl>
2239 </dd></dl>
2240 </li></ul>
2241
2242 !! end
2243
2244
2245 !! test
2246 Definition Lists: Mixed Lists: Test 4
2247 !! input
2248 *;d1 :d2
2249 *;d3 :d4
2250 !! result
2251 <ul><li><dl><dt>d1&#160;</dt><dd>d2
2252 </dd><dt>d3&#160;</dt><dd>d4
2253 </dd></dl>
2254 </li></ul>
2255
2256 !! end
2257
2258
2259 !! test
2260 Definition Lists: Mixed Lists: Test 5
2261 !! input
2262 *:d1
2263 *:: d2
2264 !! result
2265 <ul><li><dl><dd>d1
2266 <dl><dd> d2
2267 </dd></dl>
2268 </dd></dl>
2269 </li></ul>
2270
2271 !! end
2272
2273
2274 !! test
2275 Definition Lists: Mixed Lists: Test 6
2276 !! input
2277 #*:d1
2278 #*::: d3
2279 !! result
2280 <ol><li><ul><li><dl><dd>d1
2281 <dl><dd><dl><dd> d3
2282 </dd></dl>
2283 </dd></dl>
2284 </dd></dl>
2285 </li></ul>
2286 </li></ol>
2287
2288 !! end
2289
2290
2291 !! test
2292 Definition Lists: Mixed Lists: Test 7
2293 !! input
2294 :* d1
2295 :* d2
2296 !! result
2297 <dl><dd><ul><li> d1
2298 </li><li> d2
2299 </li></ul>
2300 </dd></dl>
2301
2302 !! end
2303
2304
2305 !! test
2306 Definition Lists: Mixed Lists: Test 8
2307 !! input
2308 :* d1
2309 ::* d2
2310 !! result
2311 <dl><dd><ul><li> d1
2312 </li></ul>
2313 <dl><dd><ul><li> d2
2314 </li></ul>
2315 </dd></dl>
2316 </dd></dl>
2317
2318 !! end
2319
2320
2321 !! test
2322 Definition Lists: Mixed Lists: Test 9
2323 !! input
2324 *;foo :bar
2325 !! result
2326 <ul><li><dl><dt>foo&#160;</dt><dd>bar
2327 </dd></dl>
2328 </li></ul>
2329
2330 !! end
2331
2332
2333 !! test
2334 Definition Lists: Mixed Lists: Test 10
2335 !! input
2336 *#;foo :bar
2337 !! result
2338 <ul><li><ol><li><dl><dt>foo&#160;</dt><dd>bar
2339 </dd></dl>
2340 </li></ol>
2341 </li></ul>
2342
2343 !! end
2344
2345 # The Parsoid team disagrees with the PHP parser's seemingly-random
2346 # rules regarding dd/dt on the next two tests. Parsoid is more
2347 # consistent, and recognizes the shared nesting and keeps the
2348 # still-open tags around until the nesting is complete.
2349
2350 !! test
2351 Definition Lists: Mixed Lists: Test 11 (php)
2352 !! options
2353 php
2354 !! input
2355 *#*#;*;;foo :bar
2356 *#*#;boo :baz
2357 !! result
2358 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt><dd><ul><li><dl><dt><dl><dt>bar
2359 </dt></dl>
2360 </dd></dl>
2361 </li></ul>
2362 </dd></dl>
2363 <dl><dt>boo&#160;</dt><dd>baz
2364 </dd></dl>
2365 </li></ol>
2366 </li></ul>
2367 </li></ol>
2368 </li></ul>
2369
2370 !! end
2371 !! test
2372 Definition Lists: Mixed Lists: Test 11 (parsoid)
2373 !! options
2374 parsoid
2375 !! input
2376 *#*#;*;;foo :bar
2377 *#*#;boo :baz
2378 !! result
2379 <ul><li><ol><li><ul><li><ol><li><dl><dt><ul><li><dl><dt><dl><dt>foo&nbsp;</dt><dd>bar
2380 </dd></dl></dt></dl></li></ul></dt><dt>boo&nbsp;</dt><dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
2381 !! end
2382
2383
2384 !! test
2385 Definition Lists: Weird Ones: Test 1 (php)
2386 !! options
2387 php
2388 !! input
2389 *#;*::;; foo : bar (who uses this?)
2390 !! result
2391 <ul><li><ol><li><dl><dt> foo&#160;</dt><dd><ul><li><dl><dd><dl><dd><dl><dt><dl><dt> bar (who uses this?)
2392 </dt></dl>
2393 </dd></dl>
2394 </dd></dl>
2395 </dd></dl>
2396 </li></ul>
2397 </dd></dl>
2398 </li></ol>
2399 </li></ul>
2400
2401 !! end
2402 !! test
2403 Definition Lists: Weird Ones: Test 1 (parsoid)
2404 !! options
2405 parsoid
2406 !! input
2407 *#;*::;; foo : bar (who uses this?)
2408 !! result
2409 <ul><li><ol><li><dl><dt><ul><li><dl><dd><dl><dd><dl><dt><dl><dt> foo&nbsp;</dt><dd> bar (who uses this?)</dd></dl></dt></dl></dd></dl></dd></dl></li></ul></dt></dl></li></ol></li></ul>
2410 !! end
2411
2412 ###
2413 ### External links
2414 ###
2415 !! test
2416 External links: non-bracketed
2417 !! input
2418 Non-bracketed: http://example.com
2419 !! result
2420 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
2421 </p>
2422 !! end
2423
2424 !! test
2425 External links: numbered
2426 !! input
2427 Numbered: [http://example.com]
2428 Numbered: [http://example.net]
2429 Numbered: [http://example.com]
2430 !! result
2431 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
2432 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
2433 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
2434 </p>
2435 !!end
2436
2437 !! test
2438 External links: specified text
2439 !! input
2440 Specified text: [http://example.com link]
2441 !! result
2442 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
2443 </p>
2444 !!end
2445
2446 !! test
2447 External links: trail
2448 !! input
2449 Linktrails should not work for external links: [http://example.com link]s
2450 !! result
2451 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
2452 </p>
2453 !! end
2454
2455 !! test
2456 External links: dollar sign in URL
2457 !! input
2458 http://example.com/1$2345
2459 !! result
2460 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
2461 </p>
2462 !! end
2463
2464 !! test
2465 External links: dollar sign in URL (named)
2466 !! input
2467 [http://example.com/1$2345]
2468 !! result
2469 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
2470 </p>
2471 !!end
2472
2473 !! test
2474 External links: open square bracket forbidden in URL (bug 4377)
2475 !! input
2476 http://example.com/1[2345
2477 !! result
2478 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
2479 </p>
2480 !! end
2481
2482 !! test
2483 External links: open square bracket forbidden in URL (named) (bug 4377)
2484 !! input
2485 [http://example.com/1[2345]
2486 !! result
2487 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
2488 </p>
2489 !!end
2490
2491 !! test
2492 External links: nowiki in URL link text (bug 6230)
2493 !!input
2494 [http://example.com/ <nowiki>''example site''</nowiki>]
2495 !! result
2496 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
2497 </p>
2498 !! end
2499
2500 !! test
2501 External links: newline forbidden in text (bug 6230 regression check)
2502 !! input
2503 [http://example.com/ first
2504 second]
2505 !! result
2506 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
2507 second]
2508 </p>
2509 !!end
2510
2511 !! test
2512 External links: Pipe char between url and text
2513 !! input
2514 [http://example.com | link]
2515 !! result
2516 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
2517 </p>
2518 !!end
2519
2520 !! test
2521 External links: protocol-relative URL in brackets
2522 !! input
2523 [//example.com/ Test]
2524 !! result
2525 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
2526 </p>
2527 !! end
2528
2529 !! test
2530 External links: protocol-relative URL in brackets without text
2531 !! input
2532 [//example.com]
2533 !! result
2534 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
2535 </p>
2536 !! end
2537
2538 !! test
2539 External links: protocol-relative URL in free text is left alone
2540 !! input
2541 //example.com/Foo
2542 !! result
2543 <p>//example.com/Foo
2544 </p>
2545 !!end
2546
2547 !! test
2548 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
2549 !! input
2550 foo//example.com/Foo
2551 !! result
2552 <p>foo//example.com/Foo
2553 </p>
2554 !! end
2555
2556 !! test
2557 External image
2558 !! input
2559 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2560 !! result
2561 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
2562 </p>
2563 !! end
2564
2565 !! test
2566 External image from https
2567 !! input
2568 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2569 !! result
2570 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
2571 </p>
2572 !! end
2573
2574 !! test
2575 Link to non-http image, no img tag
2576 !! input
2577 Link to non-http image, no img tag: ftp://example.com/test.jpg
2578 !! result
2579 <p>Link to non-http image, no img tag: <a rel="nofollow" class="external free" href="ftp://example.com/test.jpg">ftp://example.com/test.jpg</a>
2580 </p>
2581 !! end
2582
2583 !! test
2584 External links: terminating separator
2585 !! input
2586 Terminating separator: http://example.com/thing,
2587 !! result
2588 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
2589 </p>
2590 !! end
2591
2592 !! test
2593 External links: intervening separator
2594 !! input
2595 Intervening separator: http://example.com/1,2,3
2596 !! result
2597 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
2598 </p>
2599 !! end
2600
2601 !! test
2602 External links: old bug with URL in query
2603 !! input
2604 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
2605 !! result
2606 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
2607 </p>
2608 !! end
2609
2610 !! test
2611 External links: old URL-in-URL bug, mixed protocols
2612 !! input
2613 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
2614 !! result
2615 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
2616 </p>
2617 !!end
2618
2619 !! test
2620 External links: URL in text
2621 !! input
2622 URL in text: [http://example.com http://example.com]
2623 !! result
2624 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
2625 </p>
2626 !! end
2627
2628 !! test
2629 External links: Clickable images
2630 !! input
2631 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
2632 !! result
2633 <p>ja-style clickable images: <a rel="nofollow" class="external text" href="http://example.com"><img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" /></a>
2634 </p>
2635 !!end
2636
2637 !! test
2638 External links: raw ampersand
2639 !! input
2640 Old &amp; use: http://x&y
2641 !! result
2642 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
2643 </p>
2644 !! end
2645
2646 !! test
2647 External links: encoded ampersand
2648 !! input
2649 Old &amp; use: http://x&amp;y
2650 !! result
2651 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
2652 </p>
2653 !! end
2654
2655 !! test
2656 External links: encoded equals (bug 6102)
2657 !! input
2658 http://example.com/?foo&#61;bar
2659 !! result
2660 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
2661 </p>
2662 !! end
2663
2664 !! test
2665 External links: [raw ampersand]
2666 !! input
2667 Old &amp; use: [http://x&y]
2668 !! result
2669 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
2670 </p>
2671 !! end
2672
2673 !! test
2674 External links: [encoded ampersand]
2675 !! input
2676 Old &amp; use: [http://x&amp;y]
2677 !! result
2678 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
2679 </p>
2680 !! end
2681
2682 !! test
2683 External links: [encoded equals] (bug 6102)
2684 !! input
2685 [http://example.com/?foo&#61;bar]
2686 !! result
2687 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
2688 </p>
2689 !! end
2690
2691 !! test
2692 External links: [IDN ignored character reference in hostname; strip it right off]
2693 !! input
2694 [http://e&zwnj;xample.com/]
2695 !! result
2696 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
2697 </p>
2698 !! end
2699
2700 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
2701 # Where an external link could easily circumvent the sanitization of the text of
2702 # a link like this (where an IDN-ignore character is in the URL somewhere), this
2703 # test demands a higher standard. That's a bit strange.
2704 #
2705 # Example:
2706 #
2707 # http://e‌xample.com -> [http://example.com|http://example.com]
2708 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
2709 #
2710 # The first example is sanitized, but the second is not. Any security benefits
2711 # from this production are trivial to circumvent. Either remove this test and
2712 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
2713 # the test accordingly.
2714 #
2715 # All our love,
2716 # The Parsoid team.
2717 !! test
2718 External links: IDN ignored character reference in hostname; strip it right off
2719 !! input
2720 http://e&zwnj;xample.com/
2721 !! result
2722 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
2723 </p>
2724 !! end
2725
2726 !! test
2727 External links: www.jpeg.org (bug 554)
2728 !! input
2729 http://www.jpeg.org
2730 !!result
2731 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
2732 </p>
2733 !! end
2734
2735 !! test
2736 External links: URL within URL (original bug 2)
2737 !! input
2738 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
2739 !! result
2740 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
2741 </p>
2742 !! end
2743
2744 !! test
2745 BUG 361: URL inside bracketed URL
2746 !! input
2747 [http://www.example.com/foo http://www.example.com/bar]
2748 !! result
2749 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
2750 </p>
2751 !! end
2752
2753 !! test
2754 BUG 361: URL within URL, not bracketed
2755 !! input
2756 http://www.example.com/foo?=http://www.example.com/bar
2757 !! result
2758 <p><a rel="nofollow" class="external free" href="http://www.example.com/foo?=http://www.example.com/bar">http://www.example.com/foo?=http://www.example.com/bar</a>
2759 </p>
2760 !! end
2761
2762 !! test
2763 BUG 289: ">"-token in URL-tail
2764 !! input
2765 http://www.example.com/<hello>
2766 !! result
2767 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
2768 </p>
2769 !!end
2770
2771 !! test
2772 BUG 289: literal ">"-token in URL-tail
2773 !! input
2774 http://www.example.com/<b>html</b>
2775 !! result
2776 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
2777 </p>
2778 !!end
2779
2780 !! test
2781 BUG 289: ">"-token in bracketed URL
2782 !! input
2783 [http://www.example.com/<hello> stuff]
2784 !! result
2785 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
2786 </p>
2787 !!end
2788
2789 !! test
2790 BUG 289: literal ">"-token in bracketed URL
2791 !! input
2792 [http://www.example.com/<b>html</b> stuff]
2793 !! result
2794 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
2795 </p>
2796 !!end
2797
2798 !! test
2799 BUG 289: literal double quote at end of URL
2800 !! input
2801 http://www.example.com/"hello"
2802 !! result
2803 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
2804 </p>
2805 !!end
2806
2807 !! test
2808 BUG 289: literal double quote in bracketed URL
2809 !! input
2810 [http://www.example.com/"hello" stuff]
2811 !! result
2812 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
2813 </p>
2814 !!end
2815
2816 !! test
2817 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
2818 !! input
2819 [http://www.example.com test]
2820 !! result
2821 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
2822 </p>
2823 !! end
2824
2825 !! test
2826 External links: link text with spaces
2827 !! input
2828 [http://www.example.com a b c]
2829 [http://www.example.com ''a'' ''b'']
2830 !! result
2831 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
2832 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
2833 </p>
2834 !! end
2835
2836 !! test
2837 External links: wiki links within external link (Bug 3695)
2838 !! input
2839 [http://example.com [[wikilink]] embedded in ext link]
2840 !! result
2841 <p><a rel="nofollow" class="external text" href="http://example.com"></a><a href="/index.php?title=Wikilink&amp;action=edit&amp;redlink=1" class="new" title="Wikilink (page does not exist)">wikilink</a><a rel="nofollow" class="external text" href="http://example.com"> embedded in ext link</a>
2842 </p>
2843 !! end
2844
2845 !! test
2846 BUG 787: Links with one slash after the url protocol are invalid
2847 !! input
2848 http:/example.com
2849
2850 [http:/example.com title]
2851 !! result
2852 <p>http:/example.com
2853 </p><p>[http:/example.com title]
2854 </p>
2855 !! end
2856
2857 !! test
2858 Bracketed external links with template-generated invalid target
2859 !! input
2860 [{{echo|http:/example.com}} title]
2861 !! result
2862 <p>[http:/example.com title]
2863 </p>
2864 !! end
2865
2866 !! test
2867 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
2868 !! input
2869 ''[http://example.com text'']
2870 [http://example.com '''text]'''
2871 ''Something [http://example.com in italic'']
2872 ''Something [http://example.com mixed''''', even bold]'''
2873 '''''Now [http://example.com both''''']
2874 !! result
2875 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
2876 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
2877 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
2878 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
2879 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
2880 </p>
2881 !! end
2882
2883
2884 !! test
2885 Bug 4781: %26 in URL
2886 !! input
2887 http://www.example.com/?title=AT%26T
2888 !! result
2889 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
2890 </p>
2891 !! end
2892
2893 # According to http://dev.w3.org/html5/spec/Overview.html#parsing-urls a plain
2894 # % is actually legal in HTML5. Any change in output would need testing though.
2895 !! test
2896 Bug 4781, 5267: %25 in URL
2897 !! input
2898 http://www.example.com/?title=100%25_Bran
2899 !! result
2900 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a>
2901 </p>
2902 !! end
2903
2904 !! test
2905 Bug 4781, 5267: %28, %29 in URL
2906 !! input
2907 http://www.example.com/?title=Ben-Hur_%281959_film%29
2908 !! result
2909 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">http://www.example.com/?title=Ben-Hur_%281959_film%29</a>
2910 </p>
2911 !! end
2912
2913
2914 !! test
2915 Bug 4781: %26 in autonumber URL
2916 !! input
2917 [http://www.example.com/?title=AT%26T]
2918 !! result
2919 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
2920 </p>
2921 !! end
2922
2923 !! test
2924 Bug 4781, 5267: %26 in autonumber URL
2925 !! input
2926 [http://www.example.com/?title=100%25_Bran]
2927 !! result
2928 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
2929 </p>
2930 !! end
2931
2932 !! test
2933 Bug 4781, 5267: %28, %29 in autonumber URL
2934 !! input
2935 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
2936 !! result
2937 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
2938 </p>
2939 !! end
2940
2941
2942 !! test
2943 Bug 4781: %26 in bracketed URL
2944 !! input
2945 [http://www.example.com/?title=AT%26T link]
2946 !! result
2947 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
2948 </p>
2949 !! end
2950
2951 !! test
2952 Bug 4781, 5267: %26 in bracketed URL
2953 !! input
2954 [http://www.example.com/?title=100%25_Bran link]
2955 !! result
2956 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
2957 </p>
2958 !! end
2959
2960 !! test
2961 Bug 4781, 5267: %28, %29 in bracketed URL
2962 !! input
2963 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
2964 !! result
2965 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
2966 </p>
2967 !! end
2968
2969 !! test
2970 External link containing double-single-quotes in text '' (bug 4598 sanity check)
2971 !! input
2972 Some [http://example.com/ pretty ''italics'' and stuff]!
2973 !! result
2974 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
2975 </p>
2976 !! end
2977
2978 !! test
2979 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
2980 !! input
2981 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
2982 !! result
2983 <p><i>Some </i><a rel="nofollow" class="external text" href="http://example.com/"><i>pretty </i>italics<i> and stuff</i></a><i>!</i>
2984 </p>
2985 !! end
2986
2987 !! test
2988 External link containing double-single-quotes with no space separating the url from text in italics
2989 !! input
2990 [http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm''La muerte de Casagemas'' (1901) en el sitio de [[Museo Picasso (París)|Museo Picasso]].]
2991 !! result
2992 <p><a rel="nofollow" class="external text" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de <a href="/index.php?title=Museo_Picasso_(Par%C3%ADs)&amp;action=edit&amp;redlink=1" class="new" title="Museo Picasso (París) (page does not exist)">Museo Picasso</a>.</a>
2993 </p>
2994 !! end
2995
2996 !! test
2997 URL-encoding in URL functions (single parameter)
2998 !! input
2999 {{localurl:Some page|amp=&}}
3000 !! result
3001 <p>/index.php?title=Some_page&amp;amp=&amp;
3002 </p>
3003 !! end
3004
3005 !! test
3006 URL-encoding in URL functions (multiple parameters)
3007 !! input
3008 {{localurl:Some page|q=?&amp=&}}
3009 !! result
3010 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
3011 </p>
3012 !! end
3013
3014 !! test
3015 Brackets in urls
3016 !! input
3017 http://example.com/index.php?foozoid%5B%5D=bar
3018
3019 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
3020 !! result
3021 <p><a rel="nofollow" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a>
3022 </p><p><a rel="nofollow" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a>
3023 </p>
3024 !! end
3025
3026 !! test
3027 IPv6 urls (bug 21261)
3028 !! options
3029 disabled
3030 !! input
3031 http://[2404:130:0:1000::187:2]/index.php
3032 !! result
3033 <p><a rel="nofollow" class="external free" href="http://[2404:130:0:1000::187:2]/index.php">http://[2404:130:0:1000::187:2]/index.php</a>
3034 </p>
3035 !! end
3036
3037 !! test
3038 Non-extlinks in brackets
3039 !! input
3040 [foo]
3041 [foo bar]
3042 [foo ''bar'']
3043 [fool's] errand
3044 [fool's errand]
3045 [{{echo|foo}}]
3046 [{{echo|foo}} bar]
3047 [{{echo|foo}} ''bar'']
3048 [{{echo|foo}}l's] errand
3049 [{{echo|foo}}l's errand]
3050 [url={{echo|foo}}]
3051 [url=http://example.com]
3052 !! result
3053 <p>[foo]
3054 [foo bar]
3055 [foo <i>bar</i>]
3056 [fool's] errand
3057 [fool's errand]
3058 [foo]
3059 [foo bar]
3060 [foo <i>bar</i>]
3061 [fool's] errand
3062 [fool's errand]
3063 [url=foo]
3064 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
3065 </p>
3066 !! end
3067
3068 ###
3069 ### Quotes
3070 ###
3071
3072 !! test
3073 Quotes
3074 !! input
3075 Normal text. '''Bold text.''' Normal text. ''Italic text.''
3076
3077 Normal text. '''''Bold italic text.''''' Normal text.
3078 !!result
3079 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
3080 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
3081 </p>
3082 !! end
3083
3084
3085 !! test
3086 Unclosed and unmatched quotes (php)
3087 !! options
3088 php
3089 !! input
3090 '''''Bold italic text '''with bold deactivated''' in between.'''''
3091
3092 '''''Bold italic text ''with italic deactivated'' in between.'''''
3093
3094 '''Bold text..
3095
3096 ..spanning two paragraphs (should not work).'''
3097
3098 '''Bold tag left open
3099
3100 ''Italic tag left open
3101
3102 Normal text.
3103
3104 <!-- Unmatching number of opening, closing tags: -->
3105 '''This year''''s election ''should'' beat '''last year''''s.
3106
3107 ''Tom'''s car is bigger than ''Susan'''s.
3108
3109 Plain ''italic'''s plain
3110 !! result
3111 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
3112 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
3113 </p><p><b>Bold text..</b>
3114 </p><p>..spanning two paragraphs (should not work).
3115 </p><p><b>Bold tag left open</b>
3116 </p><p><i>Italic tag left open</i>
3117 </p><p>Normal text.
3118 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
3119 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
3120 </p><p>Plain <i>italic'</i>s plain
3121 </p>
3122 !! end
3123 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
3124 # parser strips. The wikitext contains just the first half of the bold
3125 # quote pair. (There's also a case where Parsoid nests <b> and <i>
3126 # differently than the PHP parser.)
3127 !! test
3128 Unclosed and unmatched quotes (parsoid)
3129 !! options
3130 parsoid
3131 !! input
3132 '''''Bold italic text '''with bold deactivated''' in between.'''''
3133
3134 '''''Bold italic text ''with italic deactivated'' in between.'''''
3135
3136 '''Bold text..
3137
3138 ..spanning two paragraphs (should not work).'''
3139
3140 '''Bold tag left open
3141
3142 ''Italic tag left open
3143
3144 Normal text.
3145
3146 <!-- Unmatching number of opening, closing tags: -->
3147 '''This year''''s election ''should'' beat '''last year''''s.
3148
3149 ''Tom'''s car is bigger than ''Susan'''s.
3150
3151 Plain ''italic'''s plain
3152 !! result
3153 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
3154 </p><p><i><b>Bold italic text </b></i><b>with italic deactivated<i> in between.</i></b>
3155 </p><p><b>Bold text..</b>
3156 </p><p>..spanning two paragraphs (should not work).<b></b>
3157 </p><p><b>Bold tag left open</b>
3158 </p><p><i>Italic tag left open</i>
3159 </p><p>Normal text.
3160 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
3161 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
3162 </p><p>Plain <i>italic'</i>s plain
3163 </p>
3164 !! end
3165
3166 ###
3167 ### Tables
3168 ###
3169 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
3170 ###
3171
3172 # This should not produce <table></table> as <table><tr><td></td></tr></table>
3173 # is the bare minimun required by the spec, see:
3174 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
3175 !! test
3176 A table with no data. (php)
3177 !! options
3178 php
3179 !! input
3180 {||}
3181 !! result
3182 !! end
3183 # Parsoid team replies: empty table tags are legal in HTML5
3184 !! test
3185 A table with no data. (parsoid)
3186 !! options
3187 parsoid
3188 !! input
3189 {||}
3190 !! result
3191 <table></table>
3192 !! end
3193
3194 # A table with nothing but a caption is invalid XHTML, we might want to render
3195 # this as <p>caption</p>
3196 !! test
3197 A table with nothing but a caption (php)
3198 !! options
3199 php
3200 !! input
3201 {|
3202 |+ caption
3203 |}
3204 !! result
3205 <table>
3206 <caption> caption
3207 </caption><tr><td></td></tr></table>
3208
3209 !! end
3210 # Parsoid team replies: table with only a caption is legal in HTML5
3211 !! test
3212 A table with nothing but a caption (parsoid)
3213 !! options
3214 parsoid
3215 !! input
3216 {|
3217 |+ caption
3218 |}
3219 !! result
3220 <table><caption> caption</caption></table>
3221 !! end
3222
3223 !! test
3224 A table with caption with default-spaced attributes and a table row
3225 !! input
3226 {|
3227 |+ style="color: red;" | caption1
3228 |-
3229 | foo
3230 |}
3231 !! result
3232 <table>
3233 <caption style="color: red;"> caption1
3234 </caption>
3235 <tr>
3236 <td> foo
3237 </td></tr></table>
3238
3239 !! end
3240
3241 !! test
3242 A table with captions with non-default spaced attributes and a table row
3243 !! input
3244 {|
3245 |+style="color: red;"|caption2
3246 |+ style="color: red;"| caption3
3247 |-
3248 | foo
3249 |}
3250 !! result
3251 <table>
3252 <caption style="color: red;">caption2
3253 </caption>
3254 <caption style="color: red;"> caption3
3255 </caption>
3256 <tr>
3257 <td> foo
3258 </td></tr></table>
3259
3260 !! end
3261
3262 !! test
3263 Table td-cell syntax variations
3264 !! input
3265 {|
3266 | foo bar foo | baz
3267 | foo bar foo || baz
3268 | style='color:red;' | baz
3269 | style='color:red;' || baz
3270 |}
3271 !! result
3272 <table>
3273 <tr>
3274 <td> baz
3275 </td>
3276 <td> foo bar foo </td>
3277 <td> baz
3278 </td>
3279 <td style="color:red;"> baz
3280 </td>
3281 <td> style='color:red;' </td>
3282 <td> baz
3283 </td></tr></table>
3284
3285 !! end
3286
3287 !! test
3288 Simple table
3289 !! input
3290 {|
3291 | 1 || 2
3292 |-
3293 | 3 || 4
3294 |}
3295 !! result
3296 <table>
3297 <tr>
3298 <td> 1 </td>
3299 <td> 2
3300 </td></tr>
3301 <tr>
3302 <td> 3 </td>
3303 <td> 4
3304 </td></tr></table>
3305
3306 !! end
3307
3308 !! test
3309 Simple table but with multiple dashes for row wikitext
3310 !! input
3311 {|
3312 | foo
3313 |-----
3314 | bar
3315 |}
3316 !! result
3317 <table>
3318 <tr>
3319 <td> foo
3320 </td></tr>
3321 <tr>
3322 <td> bar
3323 </td></tr></table>
3324
3325 !! end
3326 !! test
3327 Multiplication table
3328 !! input
3329 {| border="1" cellpadding="2"
3330 |+Multiplication table
3331 |-
3332 ! &times; !! 1 !! 2 !! 3
3333 |-
3334 ! 1
3335 | 1 || 2 || 3
3336 |-
3337 ! 2
3338 | 2 || 4 || 6
3339 |-
3340 ! 3
3341 | 3 || 6 || 9
3342 |-
3343 ! 4
3344 | 4 || 8 || 12
3345 |-
3346 ! 5
3347 | 5 || 10 || 15
3348 |}
3349 !! result
3350 <table border="1" cellpadding="2">
3351 <caption>Multiplication table
3352 </caption>
3353 <tr>
3354 <th> &#215; </th>
3355 <th> 1 </th>
3356 <th> 2 </th>
3357 <th> 3
3358 </th></tr>
3359 <tr>
3360 <th> 1
3361 </th>
3362 <td> 1 </td>
3363 <td> 2 </td>
3364 <td> 3
3365 </td></tr>
3366 <tr>
3367 <th> 2
3368 </th>
3369 <td> 2 </td>
3370 <td> 4 </td>
3371 <td> 6
3372 </td></tr>
3373 <tr>
3374 <th> 3
3375 </th>
3376 <td> 3 </td>
3377 <td> 6 </td>
3378 <td> 9
3379 </td></tr>
3380 <tr>
3381 <th> 4
3382 </th>
3383 <td> 4 </td>
3384 <td> 8 </td>
3385 <td> 12
3386 </td></tr>
3387 <tr>
3388 <th> 5
3389 </th>
3390 <td> 5 </td>
3391 <td> 10 </td>
3392 <td> 15
3393 </td></tr></table>
3394
3395 !! end
3396
3397 !! test
3398 Accept "||" in table headings
3399 !! input
3400 {|
3401 !h1 || h2
3402 |}
3403 !! result
3404 <table>
3405 <tr>
3406 <th>h1 </th>
3407 <th> h2
3408 </th></tr></table>
3409
3410 !! end
3411
3412 !! test
3413 Accept "||" in indented table headings
3414 !! input
3415 :{|
3416 !h1 || h2
3417 |}
3418 !! result
3419 <dl><dd><table>
3420 <tr>
3421 <th>h1 </th>
3422 <th> h2
3423 </th></tr></table></dd></dl>
3424
3425 !! end
3426
3427 !! test
3428 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
3429 !! input
3430 {|
3431 !| h1
3432 || a
3433 |}
3434 !! result
3435 <table>
3436 <tr>
3437 <th> h1
3438 </th>
3439 <td> a
3440 </td></tr></table>
3441
3442 !! end
3443
3444 !!test
3445 Accept "| !" at start of line in tables (ignore !-attribute)
3446 !!input
3447 {|
3448 |-
3449 | !style="color:red" | bar
3450 |}
3451 !!result
3452 <table>
3453
3454 <tr>
3455 <td> bar
3456 </td></tr></table>
3457
3458 !!end
3459
3460 !!test
3461 Allow +/- in 2nd and later cells in a row, in 1st cell when td-attrs are present, or in 1st cell when there is a space between "|" and +/-
3462 !!input
3463 {|
3464 |-
3465 |style='color:red;'|+1
3466 |style='color:blue;'|-1
3467 |-
3468 | 1 || 2 || 3
3469 | 1 ||+2 ||-3
3470 |-
3471 | +1
3472 | -1
3473 |}
3474 !!result
3475 <table>
3476
3477 <tr>
3478 <td style="color:red;">+1
3479 </td>
3480 <td style="color:blue;">-1
3481 </td></tr>
3482 <tr>
3483 <td> 1 </td>
3484 <td> 2 </td>
3485 <td> 3
3486 </td>
3487 <td> 1 </td>
3488 <td>+2 </td>
3489 <td>-3
3490 </td></tr>
3491 <tr>
3492 <td> +1
3493 </td>
3494 <td> -1
3495 </td></tr></table>
3496
3497 !!end
3498
3499 !! test
3500 Table rowspan
3501 !! input
3502 {| border=1
3503 | Cell 1, row 1
3504 |rowspan=2| Cell 2, row 1 (and 2)
3505 | Cell 3, row 1
3506 |-
3507 | Cell 1, row 2
3508 | Cell 3, row 2
3509 |}
3510 !! result
3511 <table border="1">
3512 <tr>
3513 <td> Cell 1, row 1
3514 </td>
3515 <td rowspan="2"> Cell 2, row 1 (and 2)
3516 </td>
3517 <td> Cell 3, row 1
3518 </td></tr>
3519 <tr>
3520 <td> Cell 1, row 2
3521 </td>
3522 <td> Cell 3, row 2
3523 </td></tr></table>
3524
3525 !! end
3526
3527 !! test
3528 Nested table
3529 !! input
3530 {| border=1
3531 | &alpha;
3532 |
3533 {| bgcolor=#ABCDEF border=2
3534 |nested
3535 |-
3536 |table
3537 |}
3538 |the original table again
3539 |}
3540 !! result
3541 <table border="1">
3542 <tr>
3543 <td> &#945;
3544 </td>
3545 <td>
3546 <table bgcolor="#ABCDEF" border="2">
3547 <tr>
3548 <td>nested
3549 </td></tr>
3550 <tr>
3551 <td>table
3552 </td></tr></table>
3553 </td>
3554 <td>the original table again
3555 </td></tr></table>
3556
3557 !! end
3558
3559 !! test
3560 Invalid attributes in table cell (bug 1830)
3561 !! input
3562 {|
3563 |Cell:|broken
3564 |}
3565 !! result
3566 <table>
3567 <tr>
3568 <td>broken
3569 </td></tr></table>
3570
3571 !! end
3572
3573
3574 !! test
3575 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
3576 !! input
3577 {|
3578 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
3579 !! result
3580 <table>
3581 <tr>
3582 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
3583 <td>]" onmouseover="alert(document.cookie)"&gt;test
3584 </td>
3585 </tr>
3586 </table>
3587
3588 !! end
3589
3590
3591 !! test
3592 Indented table markup mixed with indented pre content (proposed in bug 6200)
3593 !! input
3594 <table>
3595 <tr>
3596 <td>
3597 Text that should be rendered preformatted
3598 </td>
3599 </tr>
3600 </table>
3601 !! result
3602 <table>
3603 <tr>
3604 <td>
3605 <pre>Text that should be rendered preformatted
3606 </pre>
3607 </td>
3608 </tr>
3609 </table>
3610
3611 !! end
3612
3613 !! test
3614 Template-generated table cell attributes and cell content
3615 !! input
3616 {|
3617 |{{table_attribs}}
3618 |}
3619 !! result
3620 <table>
3621 <tr>
3622 <td style="color: red"> Foo
3623 </td></tr></table>
3624
3625 !! end
3626
3627 !! test
3628 Table with row followed by newlines and table heading
3629 !! input
3630 {|
3631 |-
3632
3633 ! foo
3634 |}
3635 !! result
3636 <table>
3637
3638
3639 <tr>
3640 <th> foo
3641 </th></tr></table>
3642
3643 !! end
3644
3645 !! test
3646 Table with empty line following the start tag
3647 !! input
3648 {|
3649
3650 |-
3651 | foo
3652 |}
3653 !! result
3654 <table>
3655
3656
3657 <tr>
3658 <td> foo
3659 </td></tr></table>
3660
3661 !! end
3662
3663 # FIXME: Preserve the attribute properly (with an empty string as value) in
3664 # the PHP parser. Parsoid implements the behavior below.
3665 !! test
3666 Table attributes with empty value
3667 !! options
3668 disabled
3669 !! input
3670 {|
3671 | style=| hello
3672 |}
3673 !! result
3674 <table>
3675 <tr>
3676 <td style=""> hello
3677 </td></tr></table>
3678
3679 !! end
3680
3681 !! test
3682 Wikitext table with a lot of comments
3683 !! input
3684 {|
3685 <!-- c0 -->
3686 | foo
3687 <!-- c1 -->
3688 |- <!-- c2 -->
3689 <!-- c3 -->
3690 |<!-- c4 -->
3691 <!-- c5 -->
3692 |}
3693 !! result
3694 <table>
3695 <tr>
3696 <td> foo
3697 </td></tr>
3698 <tr>
3699 <td>
3700 </td></tr></table>
3701
3702 !! end
3703
3704 !! test
3705 Wikitext table with double-line table cell
3706 !! input
3707 {|
3708 |a
3709 b
3710 |}
3711 !! result
3712 <table>
3713 <tr>
3714 <td>a
3715 <p>b
3716 </p>
3717 </td></tr></table>
3718
3719 !! end
3720
3721 !! test
3722 Table cell with a single comment
3723 !! input
3724 {|
3725 | <!-- c1 -->
3726 | a
3727 |}
3728 !! result
3729 <table>
3730 <tr>
3731 <td>
3732 </td>
3733 <td> a
3734 </td></tr></table>
3735
3736 !! end
3737
3738 # The expected HTML structure in this test is debatable. The PHP parser does
3739 # not parse this kind of table at all. The main focus for Parsoid is on
3740 # round-tripping, so this output is ok for now. TODO: revisit!
3741 !! test
3742 Wikitext table with html-syntax row (Parsoid)
3743 !! options
3744 parsoid
3745 !! input
3746 {|
3747 |-
3748 <td>foo</td>
3749 |}
3750 !! result
3751 <table>
3752 <tbody>
3753 <tr>
3754 <td>foo</td></tr></tbody></table>
3755 !! end
3756
3757 ###
3758 ### Internal links
3759 ###
3760 !! test
3761 Plain link, capitalized
3762 !! input
3763 [[Main Page]]
3764 !! result
3765 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
3766 </p>
3767 !! end
3768
3769 !! test
3770 Plain link, uncapitalized
3771 !! input
3772 [[main Page]]
3773 !! result
3774 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
3775 </p>
3776 !! end
3777
3778 !! test
3779 Piped link
3780 !! input
3781 [[Main Page|The Main Page]]
3782 !! result
3783 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
3784 </p>
3785 !! end
3786
3787 !! test
3788 Broken link
3789 !! input
3790 [[Zigzagzogzagzig]]
3791 !! result
3792 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
3793 </p>
3794 !! end
3795
3796 !! test
3797 Broken link with fragment
3798 !! input
3799 [[Zigzagzogzagzig#zug]]
3800 !! result
3801 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
3802 </p>
3803 !! end
3804
3805 !! test
3806 Special page link with fragment
3807 !! input
3808 [[Special:Version#anchor]]
3809 !! result
3810 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
3811 </p>
3812 !! end
3813
3814 !! test
3815 Nonexistent special page link with fragment
3816 !! input
3817 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
3818 !! result
3819 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
3820 </p>
3821 !! end
3822
3823 !! test
3824 Link with prefix
3825 !! input
3826 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
3827 !! result
3828 <p>xxx<a href="/wiki/Main_Page" title="Main Page">main Page</a>, xxx<a href="/wiki/Main_Page" title="Main Page">Main Page</a>, Xxx<a href="/wiki/Main_Page" title="Main Page">main Page</a> XXX<a href="/wiki/Main_Page" title="Main Page">main Page</a>, XXX<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
3829 </p>
3830 !! end
3831
3832 !! test
3833 Link with suffix
3834 !! input
3835 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
3836 !! result
3837 <p><a href="/wiki/Main_Page" title="Main Page">Main Pagexxx</a>, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>XXX, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>!!!
3838 </p>
3839 !! end
3840
3841 !! article
3842 prefixed article
3843 !! text
3844 Some text
3845 !! endarticle
3846
3847 !! test
3848 Bug 43661: Piped links with identical prefixes
3849 !! input
3850 [[prefixed article|prefixed articles with spaces]]
3851
3852 [[prefixed article|prefixed articlesaoeu]]
3853
3854 [[Main Page|Main Page test]]
3855 !! result
3856 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
3857 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
3858 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
3859 </p>
3860 !! end
3861
3862
3863 !! test
3864 Link with HTML entity in suffix / tail
3865 !! input
3866 [[Main Page]]&quot;, [[Main Page]]&#97;
3867 !! result
3868 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>&quot;, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>&#97;
3869 </p>
3870 !! end
3871
3872 !! test
3873 Link with 3 brackets
3874 !! input
3875 [[[main page]]]
3876 !! result
3877 <p>[[[main page]]]
3878 </p>
3879 !! end
3880
3881 !! test
3882 Piped link with 3 brackets
3883 !! input
3884 [[[main page|the main page]]]
3885 !! result
3886 <p>[[[main page|the main page]]]
3887 </p>
3888 !! end
3889
3890 !! test
3891 Link with multiple pipes
3892 !! input
3893 [[Main Page|The|Main|Page]]
3894 !! result
3895 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
3896 </p>
3897 !! end
3898
3899 !! test
3900 Link to namespaces
3901 !! input
3902 [[Talk:Parser testing]], [[Meta:Disclaimers]]
3903 !! result
3904 <p><a href="/index.php?title=Talk:Parser_testing&amp;action=edit&amp;redlink=1" class="new" title="Talk:Parser testing (page does not exist)">Talk:Parser testing</a>, <a href="/index.php?title=Meta:Disclaimers&amp;action=edit&amp;redlink=1" class="new" title="Meta:Disclaimers (page does not exist)">Meta:Disclaimers</a>
3905 </p>
3906 !! end
3907
3908 !! test
3909 Piped link to namespace
3910 !! input
3911 [[Meta:Disclaimers|The disclaimers]]
3912 !! result
3913 <p><a href="/index.php?title=Meta:Disclaimers&amp;action=edit&amp;redlink=1" class="new" title="Meta:Disclaimers (page does not exist)">The disclaimers</a>
3914 </p>
3915 !! end
3916
3917 !! test
3918 Link containing }
3919 !! input
3920 [[Usually caused by a typo (oops}]]
3921 !! result
3922 <p>[[Usually caused by a typo (oops}]]
3923 </p>
3924 !! end
3925
3926 !! test
3927 Link containing % (not as a hex sequence)
3928 !! input
3929 [[7% Solution]]
3930 !! result
3931 <p><a href="/index.php?title=7%25_Solution&amp;action=edit&amp;redlink=1" class="new" title="7% Solution (page does not exist)">7% Solution</a>
3932 </p>
3933 !! end
3934
3935 !! test
3936 Link containing % as a single hex sequence interpreted to char
3937 !! input
3938 [[7%25 Solution]]
3939 !! result
3940 <p><a href="/index.php?title=7%25_Solution&amp;action=edit&amp;redlink=1" class="new" title="7% Solution (page does not exist)">7% Solution</a>
3941 </p>
3942 !!end
3943
3944 !! test
3945 Link containing % as a double hex sequence interpreted to hex sequence
3946 !! input
3947 [[7%2525 Solution]]
3948 !! result
3949 <p>[[7%2525 Solution]]
3950 </p>
3951 !!end
3952
3953 !! test
3954 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
3955 Example for such a section: == < ==
3956 !! input
3957 [[%23%3c]][[%23%3e]]
3958 !! result
3959 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
3960 </p>
3961 !! end
3962
3963 !! test
3964 Link containing "<#" and ">#" as a hex sequences
3965 !! input
3966 [[%3c%23]][[%3e%23]]
3967 !! result
3968 <p>[[%3c%23]][[%3e%23]]
3969 </p>
3970 !! end
3971
3972 !! test
3973 Link containing an equals sign
3974 !! input
3975 [[Special:BookSources/isbn=4-00-026157-6]]
3976 !! result
3977 <p><a href="/wiki/Special:BookSources/isbn%3D4-00-026157-6" title="Special:BookSources/isbn=4-00-026157-6">Special:BookSources/isbn=4-00-026157-6</a>
3978 </p>
3979 !! end
3980
3981 !! article
3982 Foo~bar
3983 !! text
3984 Just a test of an article title containing a tilde.
3985 !! endarticle
3986
3987 # note that links containing signatures, like [[Foo~~~~]], are
3988 # massaged by the pre-save transform (PST) and so the tildes are never
3989 # seen by the parser.
3990 !! test
3991 Link containing a tilde
3992 !! input
3993 [[Foo~bar]]
3994 !! result
3995 <p><a href="/wiki/Foo%7Ebar" title="Foo~bar">Foo~bar</a>
3996 </p>
3997 !! end
3998
3999 !! test
4000 Link containing double-single-quotes '' (bug 4598)
4001 !! input
4002 [[Lista d''e paise d''o munno]]
4003 !! result
4004 <p><a href="/index.php?title=Lista_d%27%27e_paise_d%27%27o_munno&amp;action=edit&amp;redlink=1" class="new" title="Lista d''e paise d''o munno (page does not exist)">Lista d''e paise d''o munno</a>
4005 </p>
4006 !! end
4007
4008 !! test
4009 Link containing double-single-quotes '' in text (bug 4598 sanity check)
4010 !! input
4011 Some [[Link|pretty ''italics'' and stuff]]!
4012 !! result
4013 <p>Some <a href="/index.php?title=Link&amp;action=edit&amp;redlink=1" class="new" title="Link (page does not exist)">pretty <i>italics</i> and stuff</a>!
4014 </p>
4015 !! end
4016
4017 !! test
4018 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
4019 !! input
4020 ''Some [[Link|pretty ''italics'' and stuff]]!
4021 !! result
4022 <p><i>Some <a href="/index.php?title=Link&amp;action=edit&amp;redlink=1" class="new" title="Link (page does not exist)">pretty <i>italics</i> and stuff</a>!</i>
4023 </p>
4024 !! end
4025
4026 !! test
4027 Link with double quotes in title part (literal) and alternate part (interpreted)
4028 !! input
4029 [[File:Denys Savchenko ''Pentecoste''.jpg]]
4030
4031 [[''Pentecoste'']]
4032
4033 [[''Pentecoste''|Pentecoste]]
4034
4035 [[''Pentecoste''|''Pentecoste'']]
4036 !! result
4037 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Denys_Savchenko_%27%27Pentecoste%27%27.jpg" class="new" title="File:Denys Savchenko &#39;&#39;Pentecoste&#39;&#39;.jpg">File:Denys Savchenko <i>Pentecoste</i>.jpg</a>
4038 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)">''Pentecoste''</a>
4039 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)">Pentecoste</a>
4040 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)"><i>Pentecoste</i></a>
4041 </p>
4042 !! end
4043
4044 !! test
4045 Broken image links with HTML captions (bug 39700)
4046 !! input
4047 [[File:Nonexistent|<script></script>]]
4048 [[File:Nonexistent|100px|<script></script>]]
4049 [[File:Nonexistent|&lt;]]
4050 [[File:Nonexistent|a<i>b</i>c]]
4051 !! result
4052 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
4053 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
4054 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
4055 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
4056 </p>
4057 !! end
4058
4059 !! test
4060 Plain link to URL
4061 !! input
4062 [[http://www.example.com]]
4063 !! result
4064 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
4065 </p>
4066 !! end
4067
4068 !! test
4069 Plain link to URL with link text
4070 !! input
4071 [[http://www.example.com Link text]]
4072 !! result
4073 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
4074 </p>
4075 !! end
4076
4077 !! test
4078 Plain link to protocol-relative URL
4079 !! input
4080 [[//www.example.com]]
4081 !! result
4082 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
4083 </p>
4084 !! end
4085
4086 !! test
4087 Plain link to protocol-relative URL with link text
4088 !! input
4089 [[//www.example.com Link text]]
4090 !! result
4091 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
4092 </p>
4093 !! end
4094
4095 !! test
4096 Plain link to page with question mark in title
4097 !! input
4098 [[A?b]]
4099
4100 [[A?b|Baz]]
4101 !! result
4102 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
4103 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
4104 </p>
4105 !! end
4106
4107
4108 # I'm fairly sure the expected result here is wrong.
4109 # We want these to be URL links, not pseudo-pages with URLs for titles....
4110 # However the current output is also pretty screwy.
4111 #
4112 # ----
4113 # I'm changing it to match the current output--it arguably makes more
4114 # sense in the light of the test above. Old expected result was:
4115 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
4116 #</p>
4117 # But I think this test is bordering on "garbage in, garbage out" anyway.
4118 # -- wtm
4119 !! test
4120 Piped link to URL
4121 !! input
4122 Piped link to URL: [[http://www.example.com|an example URL]]
4123 !! result
4124 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
4125 </p>
4126 !! end
4127
4128 !! test
4129 BUG 2: [[page|http://url/]] should link to page, not http://url/
4130 !! input
4131 [[Main Page|http://url/]]
4132 !! result
4133 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
4134 </p>
4135 !! end
4136
4137 !! test
4138 BUG 337: Escaped self-links should be bold
4139 !! options
4140 title=[[Bug462]]
4141 !! input
4142 [[Bu&#103;462]] [[Bug462]]
4143 !! result
4144 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
4145 </p>
4146 !! end
4147
4148 !! test
4149 Self-link to section should not be bold
4150 !! options
4151 title=[[Main Page]]
4152 !! input
4153 [[Main Page#section]]
4154 !! result
4155 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
4156 </p>
4157 !! end
4158
4159 !! article
4160 00
4161 !! text
4162 This is 00.
4163 !! endarticle
4164
4165 !!test
4166 Self-link to numeric title
4167 !!options
4168 title=[[0]]
4169 !!input
4170 [[0]]
4171 !!result
4172 <p><strong class="selflink">0</strong>
4173 </p>
4174 !!end
4175
4176 !!test
4177 Link to numeric-equivalent title
4178 !!options
4179 title=[[0]]
4180 !!input
4181 [[00]]
4182 !!result
4183 <p><a href="/wiki/00" title="00">00</a>
4184 </p>
4185 !!end
4186
4187 !! test
4188 <nowiki> inside a link
4189 !! input
4190 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
4191 !! result
4192 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
4193 </p>
4194 !! end
4195
4196 !! test
4197 Non-breaking spaces in title
4198 !! input
4199 [[&nbsp; Main &nbsp; Page &nbsp;]]
4200 !! result
4201 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
4202 </p>
4203 !!end
4204
4205 !! test
4206 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
4207 !! options
4208 language=ca
4209 !! input
4210 '''[[Main Page]]'''
4211 !! result
4212 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
4213 </p>
4214 !! end
4215
4216 !! test
4217 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
4218 !! options
4219 language=ca
4220 !! input
4221 ''[[Main Page]]''
4222 !! result
4223 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
4224 </p>
4225 !! end
4226
4227 !! test
4228 Internal link with en linktrail: no apostrophes (bug 27473)
4229 !! options
4230 language=en
4231 !! input
4232 [[Something]]'nice
4233 !! result
4234 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
4235 </p>
4236 !! end
4237
4238 !! test
4239 Internal link with ca linktrail with apostrophes (bug 27473)
4240 !! options
4241 language=ca
4242 !! input
4243 [[Something]]'nice
4244 !! result
4245 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
4246 </p>
4247 !! end
4248
4249 !! test
4250 Internal link with kaa linktrail with apostrophes (bug 27473)
4251 !! options
4252 language=kaa
4253 !! input
4254 [[Something]]'nice
4255 !! result
4256 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (bet ele jaratılmag'an)">Something'nice</a>
4257 </p>
4258 !! end
4259
4260 !! test
4261 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
4262 !! input
4263 [[Foo| bar]]
4264
4265 [[Foo| ''bar'']]
4266
4267 [http://wp.org foo]
4268
4269 [http://wp.org ''foo'']
4270 !! result
4271 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)"> bar</a>
4272 </p><p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)"> <i>bar</i></a>
4273 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
4274 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
4275 </p>
4276 !! end
4277
4278 ###
4279 ### Interwiki links (see maintenance/interwiki.sql)
4280 ###
4281
4282 !! test
4283 Inline interwiki link
4284 !! input
4285 [[MeatBall:SoftSecurity]]
4286 !! result
4287 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
4288 </p>
4289 !! end
4290
4291 !! test
4292 Inline interwiki link with empty title (bug 2372)
4293 !! input
4294 [[MeatBall:]]
4295 !! result
4296 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
4297 </p>
4298 !! end
4299
4300 !! test
4301 Interwiki link encoding conversion (bug 1636)
4302 !! input
4303 *[[Wikipedia:ro:Olteni&#0355;a]]
4304 *[[Wikipedia:ro:Olteni&#355;a]]
4305 !! result
4306 <ul><li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteni&#355;a</a>
4307 </li><li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteni&#355;a</a>
4308 </li></ul>
4309
4310 !! end
4311
4312 !! test
4313 Interwiki link with fragment (bug 2130)
4314 !! input
4315 [[MeatBall:SoftSecurity#foo]]
4316 !! result
4317 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
4318 </p>
4319 !! end
4320
4321 !! test
4322 Interlanguage link
4323 !! input
4324 Blah blah blah
4325 [[zh:Chinese]]
4326 !!result
4327 <p>Blah blah blah
4328 </p>
4329 !! end
4330
4331 !! test
4332 Double interlanguage link
4333 !! input
4334 Blah blah blah
4335 [[es:Spanish]]
4336 [[zh:Chinese]]
4337 !!result
4338 <p>Blah blah blah
4339 </p>
4340 !! end
4341
4342 !! test
4343 Interlanguage link, with prefix links
4344 !! options
4345 language=ln
4346 !! input
4347 Blah blah blah
4348 [[zh:Chinese]]
4349 !!result
4350 <p>Blah blah blah
4351 </p>
4352 !! end
4353
4354 !! test
4355 Double interlanguage link, with prefix links (bug 8897)
4356 !! options
4357 language=ln
4358 !! input
4359 Blah blah blah
4360 [[es:Spanish]]
4361 [[zh:Chinese]]
4362 !!result
4363 <p>Blah blah blah
4364 </p>
4365 !! end
4366
4367 !! test
4368 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
4369 !! options
4370 language=ln
4371 !! input
4372 [[WW&nbsp;II]]
4373 !!result
4374 <p><a href="/index.php?title=WW_II&amp;action=edit&amp;redlink=1" class="new" title="WW II (lonkásá ezalí tɛ̂)">WW&#160;II</a>
4375 </p>
4376 !! end
4377
4378 ##
4379 ## XHTML tidiness
4380 ###
4381
4382 !! test
4383 <br> to <br />
4384 !! input
4385 1<br>2<br />3
4386 !! result
4387 <p>1<br />2<br />3
4388 </p>
4389 !! end
4390
4391 !! test
4392 Broken br tag sanitization
4393 !! input
4394 </br>
4395 !! result
4396 <p>&lt;/br&gt;
4397 </p>
4398 !! end
4399
4400 !! test
4401 Incorrecly removing closing slashes from correctly formed XHTML
4402 !! input
4403 <br style="clear:both;" />
4404 !! result
4405 <p><br style="clear:both;" />
4406 </p>
4407 !! end
4408
4409 !! test
4410 Failing to transform badly formed HTML into correct XHTML
4411 !! input
4412 <br style="clear: left;">
4413 <br style="clear: right;">
4414 <br style="clear: both;">
4415 !! result
4416 <p><br style="clear: left;" />
4417 <br style="clear: right;" />
4418 <br style="clear: both;" />
4419 </p>
4420 !!end
4421
4422 !! test
4423 Handling html with a div self-closing tag
4424 !! input
4425 <div title />
4426 <div title/>
4427 <div title/ >
4428 <div title=bar />
4429 <div title=bar/>
4430 <div title=bar/ >
4431 !! result
4432 <p>&lt;div title /&gt;
4433 &lt;div title/&gt;
4434 </p>
4435 <div>
4436 <p>&lt;div title=bar /&gt;
4437 &lt;div title=bar/&gt;
4438 </p>
4439 <div title="bar/"></div>
4440 </div>
4441
4442 !! end
4443
4444 !! test
4445 Handling html with a br self-closing tag
4446 !! input
4447 <br title />
4448 <br title/>
4449 <br title/ >
4450 <br title=bar />
4451 <br title=bar/>
4452 <br title=bar/ >
4453 !! result
4454 <p><br title="title" />
4455 <br title="title" />
4456 <br />
4457 <br title="bar" />
4458 <br title="bar" />
4459 <br title="bar/" />
4460 </p>
4461 !! end
4462
4463 !! test
4464 Horizontal ruler (should it add that extra space?)
4465 !! input
4466 <hr>
4467 <hr >
4468 foo <hr
4469 > bar
4470 !! result
4471 <hr />
4472 <hr />
4473 foo <hr /> bar
4474
4475 !! end
4476
4477 !! test
4478 Horizontal ruler -- 4+ dashes render hr
4479 !! input
4480 ----
4481 !! result
4482 <hr />
4483
4484 !! end
4485
4486 !! test
4487 Horizontal ruler -- eats additional dashes on the same line
4488 !! input
4489 ---------
4490 !! result
4491 <hr />
4492
4493 !! end
4494
4495 !! test
4496 Horizontal ruler -- does not collapse dashes on consecutive lines
4497 !! input
4498 ----
4499 ----
4500 !! result
4501 <hr />
4502 <hr />
4503
4504 !! end
4505
4506 !! test
4507 Horizontal ruler -- <4 dashes render as plain text
4508 !! input
4509 ---
4510 !! result
4511 <p>---
4512 </p>
4513 !! end
4514
4515 !! test
4516 Horizontal ruler -- Supports content following dashes on same line
4517 !! input
4518 ---- Foo
4519 !! result
4520 <hr /> Foo
4521
4522 !! end
4523
4524 ###
4525 ### Block-level elements
4526 ###
4527 !! test
4528 Common list
4529 !! input
4530 *Common list
4531 * item 2
4532 *item 3
4533 !! result
4534 <ul><li>Common list
4535 </li><li> item 2
4536 </li><li>item 3
4537 </li></ul>
4538
4539 !! end
4540
4541 !! test
4542 Numbered list
4543 !! input
4544 #Numbered list
4545 #item 2
4546 # item 3
4547 !! result
4548 <ol><li>Numbered list
4549 </li><li>item 2
4550 </li><li> item 3
4551 </li></ol>
4552
4553 !! end
4554
4555 !! test
4556 Mixed list
4557 !! input
4558 *Mixed list
4559 *# with numbers
4560 ** and bullets
4561 *# and numbers
4562 *bullets again
4563 **bullet level 2
4564 ***bullet level 3
4565 ***#Number on level 4
4566 **bullet level 2
4567 **#Number on level 3
4568 **#Number on level 3
4569 *#number level 2
4570 *Level 1
4571 *** Level 3
4572 #** Level 3, but ordered
4573 !! result
4574 <ul><li>Mixed list
4575 <ol><li> with numbers
4576 </li></ol>
4577 <ul><li> and bullets
4578 </li></ul>
4579 <ol><li> and numbers
4580 </li></ol>
4581 </li><li>bullets again
4582 <ul><li>bullet level 2
4583 <ul><li>bullet level 3
4584 <ol><li>Number on level 4
4585 </li></ol>
4586 </li></ul>
4587 </li><li>bullet level 2
4588 <ol><li>Number on level 3
4589 </li><li>Number on level 3
4590 </li></ol>
4591 </li></ul>
4592 <ol><li>number level 2
4593 </li></ol>
4594 </li><li>Level 1
4595 <ul><li><ul><li> Level 3
4596 </li></ul>
4597 </li></ul>
4598 </li></ul>
4599 <ol><li><ul><li><ul><li> Level 3, but ordered
4600 </li></ul>
4601 </li></ul>
4602 </li></ol>
4603
4604 !! end
4605
4606 !! test
4607 Nested lists 1
4608 !! input
4609 *foo
4610 **bar
4611 !! result
4612 <ul><li>foo
4613 <ul><li>bar
4614 </li></ul>
4615 </li></ul>
4616
4617 !! end
4618
4619 !! test
4620 Nested lists 2
4621 !! input
4622 **foo
4623 *bar
4624 !! result
4625 <ul><li><ul><li>foo
4626 </li></ul>
4627 </li><li>bar
4628 </li></ul>
4629
4630 !! end
4631
4632 !! test
4633 Nested lists 3 (first element empty)
4634 !! input
4635 *
4636 **bar
4637 !! result
4638 <ul><li>
4639 <ul><li>bar
4640 </li></ul>
4641 </li></ul>
4642
4643 !! end
4644
4645 !! test
4646 Nested lists 4 (first element empty)
4647 !! input
4648 **
4649 *bar
4650 !! result
4651 <ul><li><ul><li>
4652 </li></ul>
4653 </li><li>bar
4654 </li></ul>
4655
4656 !! end
4657
4658 !! test
4659 Nested lists 5 (both elements empty)
4660 !! input
4661 **
4662 *
4663 !! result
4664 <ul><li><ul><li>
4665 </li></ul>
4666 </li><li>
4667 </li></ul>
4668
4669 !! end
4670
4671 !! test
4672 Nested lists 6 (both elements empty)
4673 !! input
4674 *
4675 **
4676 !! result
4677 <ul><li>
4678 <ul><li>
4679 </li></ul>
4680 </li></ul>
4681
4682 !! end
4683
4684 !! test
4685 Nested lists 7 (skip initial nesting levels)
4686 !! input
4687 *** foo
4688 !! result
4689 <ul><li><ul><li><ul><li> foo
4690 </li></ul>
4691 </li></ul>
4692 </li></ul>
4693
4694 !! end
4695
4696 !! test
4697 Nested lists 8 (multiple nesting transitions)
4698 !! input
4699 * foo
4700 *** bar
4701 ** baz
4702 * boo
4703 !! result
4704 <ul><li> foo
4705 <ul><li><ul><li> bar
4706 </li></ul>
4707 </li><li> baz
4708 </li></ul>
4709 </li><li> boo
4710 </li></ul>
4711
4712 !! end
4713
4714 !! test
4715 1. Lists with start-of-line-transparent tokens before bullets: Comments
4716 !! input
4717 *foo
4718 *<!--cmt-->bar
4719 <!--cmt-->*baz
4720 !! result
4721 <ul><li>foo
4722 </li><li>bar
4723 </li><li>baz
4724 </li></ul>
4725
4726 !! end
4727
4728 !! test
4729 2. Lists with start-of-line-transparent tokens before bullets: Template close
4730 !! input
4731 *foo {{echo|bar
4732 }}*baz
4733 !! result
4734 <ul><li>foo bar
4735 </li><li>baz
4736 </li></ul>
4737
4738 !! end
4739
4740 !! test
4741 Unbalanced closing block tags break a list
4742 (Disabled since php parser generates broken html -- relies on Tidy to fix up)
4743 !! options
4744 disabled
4745 !! input
4746 <div>
4747 *a</div><div>
4748 *b</div>
4749 !! result
4750 <div>
4751 <ul><li>a
4752 </li></ul></div><div>
4753 <ul><li>b
4754 </li></ul></div>
4755 !! end
4756
4757 !! test
4758 Unbalanced closing non-block tags don't break a list
4759 (Disabled since php parser generates broken html -- relies on Tidy to fix up)
4760 !! options
4761 disabled
4762 !! input
4763 <span>
4764 *a</span><span>
4765 *b</span>
4766 !! result
4767 <p><span></span>
4768 </p>
4769 <ul><li>a<span></span>
4770 </li><li>b
4771 </li></ul>
4772 !! end
4773
4774 !! test
4775 Unclosed formatting tags that straddle lists are closed and reopened
4776 (Disabled since php parser generates broken html -- relies on Tidy to fix up)
4777 !! options
4778 disabled
4779 !! input
4780 # <s> a
4781 # b </s>
4782 !! result
4783 <ol><li> <s> a </s>
4784 </li><li> <s> b </s>
4785 </li></ol>
4786 !! end
4787
4788 !!test
4789 List embedded in a non-block tag
4790 (Ugly Parsoid output -- worth fixing; Disabled for PHP parser since it relies on Tidy)
4791 !! options
4792 parsoid
4793 !!input
4794 <small>
4795 * foo
4796 </small>
4797 !!result
4798 <p><small></small></p>
4799 <small>
4800 <ul>
4801 <li> foo</li>
4802 </ul>
4803 </small>
4804 <p><small></small></p>
4805 !!end
4806
4807 !! test
4808 List items are not parsed correctly following a <pre> block (bug 785)
4809 !! input
4810 * <pre>foo</pre>
4811 * <pre>bar</pre>
4812 * zar
4813 !! result
4814 <ul><li> <pre>foo</pre>
4815 </li><li> <pre>bar</pre>
4816 </li><li> zar
4817 </li></ul>
4818
4819 !! end
4820
4821 !! test
4822 List items from template
4823 !! input
4824
4825 {{inner list}}
4826 * item 2
4827
4828 * item 0
4829 {{inner list}}
4830 * item 2
4831
4832 * item 0
4833 * notSOL{{inner list}}
4834 * item 2
4835 !! result
4836 <ul><li> item 1
4837 </li><li> item 2
4838 </li></ul>
4839 <ul><li> item 0
4840 </li><li> item 1
4841 </li><li> item 2
4842 </li></ul>
4843 <ul><li> item 0
4844 </li><li> notSOL
4845 </li><li> item 1
4846 </li><li> item 2
4847 </li></ul>
4848
4849 !! end
4850
4851 !! test
4852 List interrupted by empty line or heading
4853 !! input
4854 * foo
4855
4856 ** bar
4857 == A heading ==
4858 * Another list item
4859 !! result
4860 <ul><li> foo
4861 </li></ul>
4862 <ul><li><ul><li> bar
4863 </li></ul>
4864 </li></ul>
4865 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: A heading">edit</a>]</span> <span class="mw-headline" id="A_heading">A heading</span></h2>
4866 <ul><li> Another list item
4867 </li></ul>
4868
4869 !!end
4870
4871 !!test
4872 Multiple list tags generated by templates
4873 !!input
4874 {{echo|<li>}}a
4875 {{echo|<li>}}b
4876 {{echo|<li>}}c
4877 !!result
4878 <li>a
4879 <li>b
4880 <li>c</li>
4881 </li>
4882 </li>
4883
4884 !!end
4885
4886 !!test
4887 Single-comment whitespace lines dont break lists, but multi-comment whitespace lines do
4888 !!input
4889 *a
4890 <!--This line will NOT split the list-->
4891 *b
4892 <!--This line will NOT split the list either-->
4893 *c
4894 <!--foo--> <!--This line with more than 1 comment will split the list-->
4895 *d
4896 !!result
4897 <ul><li>a
4898 </li><li>b
4899 </li><li>c
4900 </li></ul>
4901 <ul><li>d
4902 </li></ul>
4903
4904 !!end
4905
4906 ###
4907 ### Magic Words
4908 ###
4909
4910 !! test
4911 Magic Word: {{CURRENTDAY}}
4912 !! input
4913 {{CURRENTDAY}}
4914 !! result
4915 <p>1
4916 </p>
4917 !! end
4918
4919 !! test
4920 Magic Word: {{CURRENTDAY2}}
4921 !! input
4922 {{CURRENTDAY2}}
4923 !! result
4924 <p>01
4925 </p>
4926 !! end
4927
4928 !! test
4929 Magic Word: {{CURRENTDAYNAME}}
4930 !! input
4931 {{CURRENTDAYNAME}}
4932 !! result
4933 <p>Thursday
4934 </p>
4935 !! end
4936
4937 !! test
4938 Magic Word: {{CURRENTDOW}}
4939 !! input
4940 {{CURRENTDOW}}
4941 !! result
4942 <p>4
4943 </p>
4944 !! end
4945
4946 !! test
4947 Magic Word: {{CURRENTMONTH}}
4948 !! input
4949 {{CURRENTMONTH}}
4950 !! result
4951 <p>01
4952 </p>
4953 !! end
4954
4955 !! test
4956 Magic Word: {{CURRENTMONTHABBREV}}
4957 !! input
4958 {{CURRENTMONTHABBREV}}
4959 !! result
4960 <p>Jan
4961 </p>
4962 !! end
4963
4964 !! test
4965 Magic Word: {{CURRENTMONTHNAME}}
4966 !! input
4967 {{CURRENTMONTHNAME}}
4968 !! result
4969 <p>January
4970 </p>
4971 !! end
4972
4973 !! test
4974 Magic Word: {{CURRENTMONTHNAMEGEN}}
4975 !! input
4976 {{CURRENTMONTHNAMEGEN}}
4977 !! result
4978 <p>January
4979 </p>
4980 !! end
4981
4982 !! test
4983 Magic Word: {{CURRENTTIME}}
4984 !! input
4985 {{CURRENTTIME}}
4986 !! result
4987 <p>00:02
4988 </p>
4989 !! end
4990
4991 !! test
4992 Magic Word: {{CURRENTWEEK}} (@bug 4594)
4993 !! input
4994 {{CURRENTWEEK}}
4995 !! result
4996 <p>1
4997 </p>
4998 !! end
4999
5000 !! test
5001 Magic Word: {{CURRENTYEAR}}
5002 !! input
5003 {{CURRENTYEAR}}
5004 !! result
5005 <p>1970
5006 </p>
5007 !! end
5008
5009 !! test
5010 Magic Word: {{FULLPAGENAME}}
5011 !! options
5012 title=[[User:Ævar Arnfjörð Bjarmason]]
5013 !! input
5014 {{FULLPAGENAME}}
5015 !! result
5016 <p>User:Ævar Arnfjörð Bjarmason
5017 </p>
5018 !! end
5019
5020 !! test
5021 Magic Word: {{FULLPAGENAMEE}}
5022 !! options
5023 title=[[User:Ævar Arnfjörð Bjarmason]]
5024 !! input
5025 {{FULLPAGENAMEE}}
5026 !! result
5027 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
5028 </p>
5029 !! end
5030
5031 !! test
5032 Magic Word: {{NAMESPACE}}
5033 !! options
5034 title=[[User:Ævar Arnfjörð Bjarmason]]
5035 !! input
5036 {{NAMESPACE}}
5037 !! result
5038 <p>User
5039 </p>
5040 !! end
5041
5042 !! test
5043 Magic Word: {{NAMESPACEE}}
5044 !! options
5045 title=[[User:Ævar Arnfjörð Bjarmason]]
5046 !! input
5047 {{NAMESPACEE}}
5048 !! result
5049 <p>User
5050 </p>
5051 !! end
5052
5053 !! test
5054 Magic Word: {{NAMESPACENUMBER}}
5055 !! options
5056 title=[[User:Ævar Arnfjörð Bjarmason]]
5057 !! input
5058 {{NAMESPACENUMBER}}
5059 !! result
5060 <p>2
5061 </p>
5062 !! end
5063
5064 !! test
5065 Magic Word: {{NUMBEROFFILES}}
5066 !! input
5067 {{NUMBEROFFILES}}
5068 !! result
5069 <p>3
5070 </p>
5071 !! end
5072
5073 !! test
5074 Magic Word: {{PAGENAME}}
5075 !! options
5076 title=[[User:Ævar Arnfjörð Bjarmason]]
5077 !! input
5078 {{PAGENAME}}
5079 !! result
5080 <p>Ævar Arnfjörð Bjarmason
5081 </p>
5082 !! end
5083
5084 !! test
5085 Magic Word: {{PAGENAME}} with metacharacters
5086 !! options
5087 title=[['foo & bar = baz']]
5088 !! input
5089 ''{{PAGENAME}}''
5090 !! result
5091 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
5092 </p>
5093 !! end
5094
5095 !! test
5096 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
5097 !! options
5098 title=[[*RFC 1234 http://example.com/]]
5099 !! input
5100 {{PAGENAME}}
5101 !! result
5102 <p>&#42;RFC&#32;1234 http&#58;//example.com/
5103 </p>
5104 !! end
5105
5106 !! test
5107 Magic Word: {{PAGENAMEE}}
5108 !! options
5109 title=[[User:Ævar Arnfjörð Bjarmason]]
5110 !! input
5111 {{PAGENAMEE}}
5112 !! result
5113 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
5114 </p>
5115 !! end
5116
5117 !! test
5118 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
5119 !! options
5120 title=[[*RFC 1234 http://example.com/]]
5121 !! input
5122 {{PAGENAMEE}}
5123 !! result
5124 <p>&#42;RFC_1234_http&#58;//example.com/
5125 </p>
5126 !! end
5127
5128 !! test
5129 Magic Word: {{REVISIONID}}
5130 !! input
5131 {{REVISIONID}}
5132 !! result
5133 <p>1337
5134 </p>
5135 !! end
5136
5137 !! test
5138 Magic Word: {{SCRIPTPATH}}
5139 !! input
5140 {{SCRIPTPATH}}
5141 !! result
5142 <p>/
5143 </p>
5144 !! end
5145
5146 !! test
5147 Magic Word: {{SERVER}}
5148 !! input
5149 {{SERVER}}
5150 !! result
5151 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
5152 </p>
5153 !! end
5154
5155 !! test
5156 Magic Word: {{SERVERNAME}}
5157 !! input
5158 {{SERVERNAME}}
5159 !! result
5160 <p>example.org
5161 </p>
5162 !! end
5163
5164 !! test
5165 Magic Word: {{SITENAME}}
5166 !! input
5167 {{SITENAME}}
5168 !! result
5169 <p>MediaWiki
5170 </p>
5171 !! end
5172
5173 !! test
5174 Case-sensitive magic words, when cased differently, should just be template transclusions
5175 !! input
5176 {{CurrentMonth}}
5177 {{currentday}}
5178 {{cURreNTweEK}}
5179 {{currentHour}}
5180 !! result
5181 <p><a href="/index.php?title=Template:CurrentMonth&amp;action=edit&amp;redlink=1" class="new" title="Template:CurrentMonth (page does not exist)">Template:CurrentMonth</a>
5182 <a href="/index.php?title=Template:Currentday&amp;action=edit&amp;redlink=1" class="new" title="Template:Currentday (page does not exist)">Template:Currentday</a>
5183 <a href="/index.php?title=Template:CURreNTweEK&amp;action=edit&amp;redlink=1" class="new" title="Template:CURreNTweEK (page does not exist)">Template:CURreNTweEK</a>
5184 <a href="/index.php?title=Template:CurrentHour&amp;action=edit&amp;redlink=1" class="new" title="Template:CurrentHour (page does not exist)">Template:CurrentHour</a>
5185 </p>
5186 !! end
5187
5188 !! test
5189 Case-insensitive magic words should still work with weird casing.
5190 !! input
5191 {{sErVeRNaMe}}
5192 {{LCFirst:AOEU}}
5193 {{ucFIRST:aoeu}}
5194 {{SERver}}
5195 !! result
5196 <p>example.org
5197 aOEU
5198 Aoeu
5199 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
5200 </p>
5201 !! end
5202
5203 !! test
5204 Namespace 1 {{ns:1}}
5205 !! input
5206 {{ns:1}}
5207 !! result
5208 <p>Talk
5209 </p>
5210 !! end
5211
5212 !! test
5213 Namespace 1 {{ns:01}}
5214 !! input
5215 {{ns:01}}
5216 !! result
5217 <p>Talk
5218 </p>
5219 !! end
5220
5221 !! test
5222 Namespace 0 {{ns:0}} (bug 4783)
5223 !! input
5224 {{ns:0}}
5225 !! result
5226
5227 !! end
5228
5229 !! test
5230 Namespace 0 {{ns:00}} (bug 4783)
5231 !! input
5232 {{ns:00}}
5233 !! result
5234
5235 !! end
5236
5237 !! test
5238 Namespace -1 {{ns:-1}}
5239 !! input
5240 {{ns:-1}}
5241 !! result
5242 <p>Special
5243 </p>
5244 !! end
5245
5246 !! test
5247 Namespace User {{ns:User}}
5248 !! input
5249 {{ns:User}}
5250 !! result
5251 <p>User
5252 </p>
5253 !! end
5254
5255 !! test
5256 Namespace User talk {{ns:User_talk}}
5257 !! input
5258 {{ns:User_talk}}
5259 !! result
5260 <p>User talk
5261 </p>
5262 !! end
5263
5264 !! test
5265 Namespace User talk {{ns:uSeR tAlK}}
5266 !! input
5267 {{ns:uSeR tAlK}}
5268 !! result
5269 <p>User talk
5270 </p>
5271 !! end
5272
5273 !! test
5274 Namespace File {{ns:File}}
5275 !! input
5276 {{ns:File}}
5277 !! result
5278 <p>File
5279 </p>
5280 !! end
5281
5282 !! test
5283 Namespace File {{ns:Image}}
5284 !! input
5285 {{ns:Image}}
5286 !! result
5287 <p>File
5288 </p>
5289 !! end
5290
5291 !! test
5292 Namespace (lang=de) Benutzer {{ns:User}}
5293 !! options
5294 language=de
5295 !! input
5296 {{ns:User}}
5297 !! result
5298 <p>Benutzer
5299 </p>
5300 !! end
5301
5302 !! test
5303 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
5304 !! options
5305 language=de
5306 !! input
5307 {{ns:3}}
5308 !! result
5309 <p>Benutzer Diskussion
5310 </p>
5311 !! end
5312
5313
5314 !! test
5315 Urlencode
5316 !! input
5317 {{urlencode:hi world?!}}
5318 {{urlencode:hi world?!|WIKI}}
5319 {{urlencode:hi world?!|PATH}}
5320 {{urlencode:hi world?!|QUERY}}
5321 !! result
5322 <p>hi+world%3F%21
5323 hi_world%3F!
5324 hi%20world%3F%21
5325 hi+world%3F%21
5326 </p>
5327 !! end
5328
5329 ###
5330 ### Magic links
5331 ###
5332 !! test
5333 Magic links: internal link to RFC (bug 479)
5334 !! input
5335 [[RFC 123]]
5336 !! result
5337 <p><a href="/index.php?title=RFC_123&amp;action=edit&amp;redlink=1" class="new" title="RFC 123 (page does not exist)">RFC 123</a>
5338 </p>
5339 !! end
5340
5341 !! test
5342 Magic links: RFC (bug 479)
5343 !! input
5344 RFC 822
5345 !! result
5346 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
5347 </p>
5348 !! end
5349
5350 !! test
5351 Magic links: ISBN (bug 1937)
5352 !! input
5353 ISBN 0-306-40615-2
5354 !! result
5355 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
5356 </p>
5357 !! end
5358
5359 !! test
5360 Magic links: PMID incorrectly converts space to underscore
5361 !! input
5362 PMID 1234
5363 !! result
5364 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
5365 </p>
5366 !! end
5367
5368 ###
5369 ### Templates
5370 ####
5371
5372 !! test
5373 Nonexistent template
5374 !! input
5375 {{thistemplatedoesnotexist}}
5376 !! result
5377 <p><a href="/index.php?title=Template:Thistemplatedoesnotexist&amp;action=edit&amp;redlink=1" class="new" title="Template:Thistemplatedoesnotexist (page does not exist)">Template:Thistemplatedoesnotexist</a>
5378 </p>
5379 !! end
5380
5381 !! test
5382 Template with invalid target containing tags
5383 !! input
5384 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
5385 !! result
5386 <p>{{a<b>b</b>|foo|a=b|a = b}}
5387 </p>
5388 !! end
5389
5390 !! test
5391 Template with invalid target containing unclosed tag
5392 !! input
5393 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
5394 !! result
5395 <p>{{a<b>|foo|a=b|a = b}}</b>
5396 </p>
5397 !! end
5398
5399 !! article
5400 Template:test
5401 !! text
5402 This is a test template
5403 !! endarticle
5404
5405 !! test
5406 Simple template
5407 !! input
5408 {{test}}
5409 !! result
5410 <p>This is a test template
5411 </p>
5412 !! end
5413
5414 !! test
5415 Template with explicit namespace
5416 !! input
5417 {{Template:test}}
5418 !! result
5419 <p>This is a test template
5420 </p>
5421 !! end
5422
5423
5424 !! article
5425 Template:paramtest
5426 !! text
5427 This is a test template with parameter {{{param}}}
5428 !! endarticle
5429
5430 !! test
5431 Template parameter
5432 !! input
5433 {{paramtest|param=foo}}
5434 !! result
5435 <p>This is a test template with parameter foo
5436 </p>
5437 !! end
5438
5439 !! article
5440 Template:paramtestnum
5441 !! text
5442 [[{{{1}}}|{{{2}}}]]
5443 !! endarticle
5444
5445 !! test
5446 Template unnamed parameter
5447 !! input
5448 {{paramtestnum|Main Page|the main page}}
5449 !! result
5450 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
5451 </p>
5452 !! end
5453
5454 !! article
5455 Template:templatesimple
5456 !! text
5457 (test)
5458 !! endarticle
5459
5460 !! article
5461 Template:templateredirect
5462 !! text
5463 #redirect [[Template:templatesimple]]
5464 !! endarticle
5465
5466 !! article
5467 Template:templateasargtestnum
5468 !! text
5469 {{{{{1}}}}}
5470 !! endarticle
5471
5472 !! article
5473 Template:templateasargtest
5474 !! text
5475 {{template{{{templ}}}}}
5476 !! endarticle
5477
5478 !! article
5479 Template:templateasargtest2
5480 !! text
5481 {{{{{templ}}}}}
5482 !! endarticle
5483
5484 !! test
5485 Template with template name as unnamed argument
5486 !! input
5487 {{templateasargtestnum|templatesimple}}
5488 !! result
5489 <p>(test)
5490 </p>
5491 !! end
5492
5493 !! test
5494 Template with template name as argument
5495 !! input
5496 {{templateasargtest|templ=simple}}
5497 !! result
5498 <p>(test)
5499 </p>
5500 !! end
5501
5502 !! test
5503 Template with template name as argument (2)
5504 !! input
5505 {{templateasargtest2|templ=templatesimple}}
5506 !! result
5507 <p>(test)
5508 </p>
5509 !! end
5510
5511 !! article
5512 Template:templateasargtestdefault
5513 !! text
5514 {{{{{templ|templatesimple}}}}}
5515 !! endarticle
5516
5517 !! article
5518 Template:templa
5519 !! text
5520 '''templ'''
5521 !! endarticle
5522
5523 !! test
5524 Template with default value
5525 !! input
5526 {{templateasargtestdefault}}
5527 !! result
5528 <p>(test)
5529 </p>
5530 !! end
5531
5532 !! test
5533 Template with default value (value set)
5534 !! input
5535 {{templateasargtestdefault|templ=templa}}
5536 !! result
5537 <p><b>templ</b>
5538 </p>
5539 !! end
5540
5541 !! test
5542 Template redirect
5543 !! input
5544 {{templateredirect}}
5545 !! result
5546 <p>(test)
5547 </p>
5548 !! end
5549
5550 !! test
5551 Template with argument in separate line
5552 !! input
5553 {{ templateasargtest |
5554 templ = simple }}
5555 !! result
5556 <p>(test)
5557 </p>
5558 !! end
5559
5560 !! test
5561 Template with complex template as argument
5562 !! input
5563 {{paramtest|
5564 param ={{ templateasargtest |
5565 templ = simple }}}}
5566 !! result
5567 <p>This is a test template with parameter (test)
5568 </p>
5569 !! end
5570
5571 !! test
5572 Template with thumb image (with link in description)
5573 !! input
5574 {{paramtest|
5575 param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
5576 !! result
5577 This is a test template with parameter <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/index.php?title=Special:Upload&amp;wpDestFile=Noimage.png" class="new" title="File:Noimage.png">File:Noimage.png</a> <div class="thumbcaption"><a href="/index.php?title=No_link&amp;action=edit&amp;redlink=1" class="new" title="No link (page does not exist)">link</a> <a href="/index.php?title=No_link&amp;action=edit&amp;redlink=1" class="new" title="No link (page does not exist)">caption</a></div></div></div>
5578
5579 !! end
5580
5581 !! article
5582 Template:complextemplate
5583 !! text
5584 {{{1}}} {{paramtest|
5585 param ={{{param}}}}}
5586 !! endarticle
5587
5588 !! test
5589 Template with complex arguments
5590 !! input
5591 {{complextemplate|
5592 param ={{ templateasargtest |
5593 templ = simple }}|[[Template:complextemplate|link]]}}
5594 !! result
5595 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
5596 </p>
5597 !! end
5598
5599 !! test
5600 BUG 553: link with two variables in a piped link
5601 !! input
5602 {|
5603 |[[{{{1}}}|{{{2}}}]]
5604 |}
5605 !! result
5606 <table>
5607 <tr>
5608 <td>[[{{{1}}}|{{{2}}}]]
5609 </td></tr></table>
5610
5611 !! end
5612
5613 !! test
5614 Magic variable as template parameter
5615 !! input
5616 {{paramtest|param={{SITENAME}}}}
5617 !! result
5618 <p>This is a test template with parameter MediaWiki
5619 </p>
5620 !! end
5621
5622 !! article
5623 Template:linktest
5624 !! text
5625 [[{{{param}}}|link]]
5626 !! endarticle
5627
5628 !! test
5629 Template parameter as link source
5630 !! input
5631 {{linktest|param=Main Page}}
5632 !! result
5633 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
5634 </p>
5635 !! end
5636
5637 !!test
5638 Template-generated attribute string (k='v')
5639 !!input
5640 <span {{attr_str|id|v1}}>bar</span>
5641 !!result
5642 <p><span id="v1">bar</span>
5643 </p>
5644 !!end
5645
5646 !!article
5647 Template:paramtest2
5648 !! text
5649 including another template, {{paramtest|param={{{arg}}}}}
5650 !! endarticle
5651
5652 !! test
5653 Template passing argument to another template
5654 !! input
5655 {{paramtest2|arg='hmm'}}
5656 !! result
5657 <p>including another template, This is a test template with parameter 'hmm'
5658 </p>
5659 !! end
5660
5661 !! article
5662 Template:Linktest2
5663 !! text
5664 Main Page
5665 !! endarticle
5666
5667 !! test
5668 Template as link source
5669 !! input
5670 [[{{linktest2}}]]
5671
5672 [[{{linktest2}}|Main Page]]
5673
5674 [[{{linktest2}}]]Page
5675 !! result
5676 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
5677 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
5678 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
5679 </p>
5680 !! end
5681
5682
5683 !! article
5684 Template:loop1
5685 !! text
5686 {{loop2}}
5687 !! endarticle
5688
5689 !! article
5690 Template:loop2
5691 !! text
5692 {{loop1}}
5693 !! endarticle
5694
5695 !! test
5696 Template infinite loop
5697 !! input
5698 {{loop1}}
5699 !! result
5700 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
5701 </p>
5702 !! end
5703
5704 !! test
5705 Template from main namespace
5706 !! input
5707 {{:Main Page}}
5708 !! result
5709 <p>blah blah
5710 </p>
5711 !! end
5712
5713 !! article
5714 Template:table
5715 !! text
5716 {|
5717 | 1 || 2
5718 |-
5719 | 3 || 4
5720 |}
5721 !! endarticle
5722
5723 !! test
5724 BUG 529: Template with table, not included at beginning of line
5725 !! input
5726 foo {{table}}
5727 !! result
5728 <p>foo
5729 </p>
5730 <table>
5731 <tr>
5732 <td> 1 </td>
5733 <td> 2
5734 </td></tr>
5735 <tr>
5736 <td> 3 </td>
5737 <td> 4
5738 </td></tr></table>
5739
5740 !! end
5741
5742 !! test
5743 BUG 523: Template shouldn't eat newline (or add an extra one before table)
5744 !! input
5745 foo
5746 {{table}}
5747 !! result
5748 <p>foo
5749 </p>
5750 <table>
5751 <tr>
5752 <td> 1 </td>
5753 <td> 2
5754 </td></tr>
5755 <tr>
5756 <td> 3 </td>
5757 <td> 4
5758 </td></tr></table>
5759
5760 !! end
5761
5762 !! test
5763 BUG 41: Template parameters shown as broken links
5764 !! input
5765 {{{parameter}}}
5766 !! result
5767 <p>{{{parameter}}}
5768 </p>
5769 !! end
5770
5771 !! test
5772 Template with targets containing wikilinks
5773 !! input
5774 {{[[foo]]}}
5775
5776 {{[[{{echo|foo}}]]}}
5777
5778 {{{{echo|[[foo}}]]}}
5779 !! result
5780 <p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
5781 </p><p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
5782 </p><p>{{[[foo}}]]
5783 </p>
5784 !! end
5785
5786 !! article
5787 Template:MSGNW test
5788 !! text
5789 ''None'' of '''this''' should be
5790 * interpreted
5791 but rather passed unmodified
5792 {{test}}
5793 !! endarticle
5794
5795 # hmm, fix this or just deprecate msgnw and document its behavior?
5796 !! test
5797 msgnw keyword
5798 !! options
5799 disabled
5800 !! input
5801 {{msgnw:MSGNW test}}
5802 !! result
5803 <p>''None'' of '''this''' should be
5804 * interpreted
5805 but rather passed unmodified
5806 {{test}}
5807 </p>
5808 !! end
5809
5810 !! test
5811 int keyword
5812 !! input
5813 {{int:youhavenewmessages|lots of money|not!}}
5814 !! result
5815 <p>You have lots of money (not!).
5816 </p>
5817 !! end
5818
5819 !! article
5820 Template:Includes
5821 !! text
5822 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
5823 !! endarticle
5824
5825 !! test
5826 <includeonly> and <noinclude> being included
5827 !! input
5828 {{Includes}}
5829 !! result
5830 <p>Foobar
5831 </p>
5832 !! end
5833
5834 !! article
5835 Template:Includes2
5836 !! text
5837 <onlyinclude>Foo</onlyinclude>bar
5838 !! endarticle
5839
5840 !! test
5841 <onlyinclude> being included
5842 !! input
5843 {{Includes2}}
5844 !! result
5845 <p>Foo
5846 </p>
5847 !! end
5848
5849
5850 !! article
5851 Template:Includes3
5852 !! text
5853 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
5854 !! endarticle
5855
5856 !! test
5857 <onlyinclude> and <includeonly> being included
5858 !! input
5859 {{Includes3}}
5860 !! result
5861 <p>Foo
5862 </p>
5863 !! end
5864
5865 !! test
5866 <includeonly> and <noinclude> on a page
5867 !! input
5868 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
5869 !! result
5870 <p>Foozar
5871 </p>
5872 !! end
5873
5874 !! test
5875 Un-closed <noinclude>
5876 !! input
5877 <noinclude>
5878 !! result
5879 !! end
5880
5881 !! test
5882 <onlyinclude> on a page
5883 !! input
5884 <onlyinclude>Foo</onlyinclude>bar
5885 !! result
5886 <p>Foobar
5887 </p>
5888 !! end
5889
5890 !! test
5891 Un-closed <onlyinclude>
5892 !! input
5893 <onlyinclude>
5894 !! result
5895 !! end
5896
5897 !!test
5898 Self-closed noinclude, includeonly, onlyinclude tags
5899 !!input
5900 <noinclude />
5901 <includeonly />
5902 <onlyinclude />
5903 !!result
5904 <p><br />
5905 </p>
5906 !!end
5907
5908 !!test
5909 Unbalanced includeonly and noinclude tags
5910 !!input
5911 {|
5912 |a</noinclude>
5913 |b</noinclude></noinclude>
5914 |c</noinclude></includeonly>
5915 |d</includeonly></includeonly>
5916 |}
5917 !!result
5918 <table>
5919 <tr>
5920 <td>a
5921 </td>
5922 <td>b
5923 </td>
5924 <td>c&lt;/includeonly&gt;
5925 </td>
5926 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
5927 </td></tr></table>
5928
5929 !!end
5930
5931 !! article
5932 Template:Includeonly section
5933 !! text
5934 <includeonly>
5935 ==Includeonly section==
5936 </includeonly>
5937 ==Section T-1==
5938 !!endarticle
5939
5940 !! test
5941 Bug 6563: Edit link generation for section shown by <includeonly>
5942 !! input
5943 {{includeonly section}}
5944 !! result
5945 <h2><span class="editsection">[<a href="/index.php?title=Template:Includeonly_section&amp;action=edit&amp;section=T-1" title="Template:Includeonly section">edit</a>]</span> <span class="mw-headline" id="Includeonly_section">Includeonly section</span></h2>
5946 <h2><span class="editsection">[<a href="/index.php?title=Template:Includeonly_section&amp;action=edit&amp;section=T-2" title="Template:Includeonly section">edit</a>]</span> <span class="mw-headline" id="Section_T-1">Section T-1</span></h2>
5947
5948 !! end
5949
5950 # Uses same input as the contents of [[Template:Includeonly section]]
5951 !! test
5952 Bug 6563: Section extraction for section shown by <includeonly>
5953 !! options
5954 section=T-2
5955 !! input
5956 <includeonly>
5957 ==Includeonly section==
5958 </includeonly>
5959 ==Section T-2==
5960 !! result
5961 ==Section T-2==
5962 !! end
5963
5964 !! test
5965 Bug 6563: Edit link generation for section suppressed by <includeonly>
5966 !! input
5967 <includeonly>
5968 ==Includeonly section==
5969 </includeonly>
5970 ==Section 1==
5971 !! result
5972 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 1">edit</a>]</span> <span class="mw-headline" id="Section_1">Section 1</span></h2>
5973
5974 !! end
5975
5976 !! test
5977 Bug 6563: Section extraction for section suppressed by <includeonly>
5978 !! options
5979 section=1
5980 !! input
5981 <includeonly>
5982 ==Includeonly section==
5983 </includeonly>
5984 ==Section 1==
5985 !! result
5986 ==Section 1==
5987 !! end
5988
5989 !! test
5990 Un-closed <includeonly>
5991 !! input
5992 <includeonly>
5993 !! result
5994 !! end
5995
5996 ###
5997 ### <includeonly> and <noinclude> in attributes
5998 ###
5999 !!test
6000 0. includeonly around the entire attribute
6001 !!input
6002 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
6003 !!result
6004 <p><span id="v2">bar</span>
6005 </p>
6006 !!end
6007
6008 !!test
6009 1. includeonly in html attr key
6010 !!input
6011 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
6012 !!result
6013 <p><span id="foo">bar</span>
6014 </p>
6015 !!end
6016
6017 !!test
6018 2. includeonly in html attr value
6019 !!input
6020 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
6021 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
6022 !!result
6023 <p><span id="v1">bar</span>
6024 <span id="v1">bar</span>
6025 </p>
6026 !!end
6027
6028 !!test
6029 3. includeonly in part of an attr value
6030 !!input
6031 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
6032 !!result
6033 <p><span style="color:red;">bar</span>
6034 </p>
6035 !!end
6036
6037 ###
6038 ### Testing parsing of templates where a template arg
6039 ### has the same name as the template itself.
6040 ###
6041
6042 !! article
6043 Template:quote
6044 !! text
6045 {{{quote|{{{1}}}}}}
6046 !! endarticle
6047
6048 !!test
6049 Templates: Template Name/Arg clash: 1. Use of positional param
6050 !!input
6051 {{quote|foo}}
6052 !!result
6053 <p>foo
6054 </p>
6055 !!end
6056
6057 !!test
6058 Templates: Template Name/Arg clash: 2. Use of named param
6059 !!input
6060 {{quote|quote=foo}}
6061 !!result
6062 <p>foo
6063 </p>
6064 !!end
6065
6066 !!test
6067 Templates: Template Name/Arg clash: 3. Use of named param with empty input
6068 !!input
6069 {{quote|quote}}
6070 !!result
6071 <p>quote
6072 </p>
6073 !!end
6074
6075 ###
6076 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
6077 ###
6078
6079 !!test
6080 Templates: 1. Simple use
6081 !!input
6082 {{echo|Foo}}
6083 !!result
6084 <p>Foo
6085 </p>
6086 !!end
6087
6088 !!test
6089 Templates: 2. Inside a block tag
6090 !!input
6091 <div>{{echo|Foo}}</div>
6092 !!result
6093 <div>Foo</div>
6094
6095 !!end
6096
6097 !!test
6098 Templates: P-wrapping: 1a. Templates on consecutive lines
6099 !!input
6100 {{echo|Foo}}
6101 {{echo|bar}}
6102 !!result
6103 <p>Foo
6104 bar
6105 </p>
6106 !!end
6107
6108 !!test
6109 Templates: P-wrapping: 1b. Templates on consecutive lines
6110 !!input
6111 Foo
6112
6113 {{echo|bar}}
6114 {{echo|baz}}
6115 !!result
6116 <p>Foo
6117 </p><p>bar
6118 baz
6119 </p>
6120 !!end
6121
6122 !!test
6123 Templates: P-wrapping: 1c. Templates on consecutive lines
6124 !!input
6125 {{echo|Foo}}
6126 {{echo|bar}} <div>baz</div>
6127 !!result
6128 <p>Foo
6129 </p>
6130 bar <div>baz</div>
6131
6132 !!end
6133
6134 !!test
6135 Templates: Inline Text: 1. Multiple tmeplate uses
6136 !!input
6137 {{echo|Foo}}bar{{echo|baz}}
6138 !!result
6139 <p>Foobarbaz
6140 </p>
6141 !!end
6142
6143 !!test
6144 Templates: Inline Text: 2. Back-to-back template uses
6145 !!input
6146 {{echo|Foo}}{{echo|bar}}
6147 !!result
6148 <p>Foobar
6149 </p>
6150 !!end
6151
6152 !!test
6153 Templates: Block Tags: 1. Multiple template uses
6154 !!input
6155 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
6156 !!result
6157 <div>Foo</div><div>bar</div><div>baz</div>
6158
6159 !!end
6160
6161 !!test
6162 Templates: Block Tags: 2. Back-to-back template uses
6163 !!input
6164 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
6165 !!result
6166 <div>Foo</div><div>bar</div>
6167
6168 !!end
6169
6170 !!test
6171 Templates: Links: 1. Simple example
6172 !!input
6173 {{echo|[[Foo|bar]]}}
6174 !!result
6175 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6176 </p>
6177 !!end
6178
6179 !!test
6180 Templates: Links: 2. Generation of link href
6181 !!input
6182 [[{{echo|Foo}}|bar]]
6183 !!result
6184 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6185 </p>
6186 !!end
6187
6188 !!test
6189 Templates: Links: 3. Generation of part of a link href
6190 !!input
6191 [[Fo{{echo|o}}|bar]]
6192
6193 [[Foo{{echo|bar}}]]
6194
6195 [[Foo{{echo|bar}}baz]]
6196
6197 [[Foo{{echo|bar}}|bar]]
6198
6199 [[:Foo{{echo|bar}}]]
6200
6201 [[:Foo{{echo|bar}}|bar]]
6202 !!result
6203 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6204 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
6205 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
6206 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
6207 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
6208 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
6209 </p>
6210 !!end
6211
6212 !!test
6213 Templates: Links: 4. Multiple templates generating link href
6214 !!input
6215 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
6216 !!result
6217 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
6218 </p>
6219 !!end
6220
6221 !!test
6222 Templates: Links: 5. Generation of link text
6223 !!input
6224 [[Foo|{{echo|bar}}]]
6225 !!result
6226 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6227 </p>
6228 !!end
6229
6230 !!test
6231 Templates: Links: 5. Nested templates (only outermost template should be marked)
6232 !!input
6233 {{echo|[[{{echo|Foo}}|bar]]}}
6234 !!result
6235 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6236 </p>
6237 !!end
6238
6239 !!test
6240 Templates: HTML Tag: 1. Generation of HTML attr. key
6241 !!input
6242 <div {{echo|style}}="color:red;">foo</div>
6243 !!result
6244 <div style="color:red;">foo</div>
6245
6246 !!end
6247
6248 !!test
6249 Templates: HTML Tag: 2. Generation of HTML attr. value
6250 !!input
6251 <div style={{echo|'color:red;'}}>foo</div>
6252 !!result
6253 <div style="color:red;">foo</div>
6254
6255 !!end
6256
6257 !!test
6258 Templates: HTML Tag: 3. Generation of HTML attr key and value
6259 !!input
6260 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
6261 !!result
6262 <div style="color:red;">foo</div>
6263
6264 !!end
6265
6266 !!test
6267 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
6268 !!input
6269 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
6270 !!result
6271 <div title="This is a long title with just one piece templated">foo</div>
6272
6273 !!end
6274
6275 !!test
6276 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
6277 !!input
6278 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
6279 !!result
6280 <div title="This is a long title with just one piece templated">foo</div>
6281
6282 !!end
6283
6284 !!test
6285 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
6286 !!input
6287 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
6288 !!result
6289 <div title="This is a long title with just one piece templated">foo</div>
6290
6291 !!end
6292
6293 !!test
6294 Templates: HTML Tag: 7. Generation of partial attribute key string
6295 !!input
6296 <div st{{echo|yle}}="color:red;">foo</div>
6297 !!result
6298 <div style="color:red;">foo</div>
6299
6300 !!end
6301
6302 !!test
6303 Templates: HTML Tables: 1. Generating start of a HTML table
6304 !!input
6305 {{echo|<table><tr><td>foo</td>}}</tr></table>
6306 !!result
6307 <table><tr><td>foo</td></tr></table>
6308
6309 !!end
6310
6311 !!test
6312 Templates: HTML Tables: 2a. Generating middle of a HTML table
6313 !!input
6314 <table><tr>{{echo|<td>foo</td>}}</tr></table>
6315 !!result
6316 <table><tr><td>foo</td></tr></table>
6317
6318 !!end
6319
6320 !!test
6321 Templates: HTML Tables: 2b. Generating middle of a HTML table
6322 !!input
6323 <table>{{echo|<tr><td>foo</td></tr>}}</table>
6324 !!result
6325 <table><tr><td>foo</td></tr></table>
6326
6327 !!end
6328
6329 !!test
6330 Templates: HTML Tables: 3. Generating end of a HTML table
6331 !!input
6332 <table><tr>{{echo|<td>foo</td></tr></table>}}
6333 !!result
6334 <table><tr><td>foo</td></tr></table>
6335
6336 !!end
6337
6338 !!test
6339 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
6340 !!input
6341 {{echo|<table>}}<tr><td>foo</td></tr></table>
6342 !!result
6343 <table><tr><td>foo</td></tr></table>
6344
6345 !!end
6346
6347 !!test
6348 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
6349 !!input
6350 <table>{{echo|<tr>}}<td>foo</td></tr></table>
6351 !!result
6352 <table><tr><td>foo</td></tr></table>
6353
6354 !!end
6355
6356 !!test
6357 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
6358 !!input
6359 <table><tr>{{echo|<td>}}foo</td></tr></table>
6360 !!result
6361 <table><tr><td>foo</td></tr></table>
6362
6363 !!end
6364
6365 !!test
6366 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
6367 !!input
6368 <table><tr><td>foo{{echo|</td>}}</tr></table>
6369 !!result
6370 <table><tr><td>foo</td></tr></table>
6371
6372 !!end
6373
6374 !!test
6375 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
6376 !!input
6377 <table><tr><td>foo</td>{{echo|</tr>}}</table>
6378 !!result
6379 <table><tr><td>foo</td></tr></table>
6380
6381 !!end
6382
6383 !!test
6384 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
6385 !!input
6386 <table><tr><td>foo</td></tr>{{echo|</table>}}
6387 !!result
6388 <table><tr><td>foo</td></tr></table>
6389
6390 !!end
6391
6392 !!test
6393 Templates: Wiki Tables: 1a. Fostering of entire template content
6394 !!input
6395 {|
6396 {{echo|a}}
6397 |}
6398 !!result
6399 <table>
6400 a
6401 <tr><td></td></tr></table>
6402
6403 !!end
6404
6405 !!test
6406 Templates: Wiki Tables: 1b. Fostering of entire template content
6407 !!input
6408 {|
6409 {{echo|<div>}}
6410 foo
6411 {{echo|</div>}}
6412 |}
6413 !!result
6414 <table>
6415 <div>
6416 <p>foo
6417 </p>
6418 </div>
6419 <tr><td></td></tr></table>
6420
6421 !!end
6422
6423 !!test
6424 Templates: Wiki Tables: 2. Fostering of partial template content
6425 !!input
6426 {|
6427 {{echo|a
6428 <div>b</div>}}
6429 |}
6430 !!result
6431 <table>
6432 a
6433 <div>b</div>
6434 <tr><td></td></tr></table>
6435
6436 !!end
6437
6438 !!test
6439 Templates: Wiki Tables: 3. td-content via multiple templates
6440 !!input
6441 {|
6442 {{echo|{{pipe}}a}}{{echo|b}}
6443 |}
6444 !!result
6445 <table>
6446 <tr>
6447 <td>ab
6448 </td></tr></table>
6449
6450 !!end
6451
6452 !!test
6453 Templates: Wiki Tables: 4. Templated tags, no content
6454 !!input
6455 {{tbl-start}}
6456 {{tbl-end}}
6457 !!result
6458 <table>
6459 <tr><td></td></tr></table>
6460
6461 !!end
6462
6463 !!test
6464 Templates: Wiki Tables: 5. Templated tags, regular td-tags
6465 !!input
6466 {{tbl-start}}
6467 |foo
6468 {{tbl-end}}
6469 !!result
6470 <table>
6471 <tr>
6472 <td>foo
6473 </td></tr></table>
6474
6475 !!end
6476
6477 !!test
6478 Templates: Wiki Tables: 6. Templated tags, templated td-tags
6479 !!input
6480 {{tbl-start}}
6481 {{!}}foo
6482 {{tbl-end}}
6483 !!result
6484 <table>
6485 <tr>
6486 <td>foo
6487 </td></tr></table>
6488
6489 !!end
6490
6491 !!test
6492 Templates: Lists: Multi-line list-items via templates
6493 !!input
6494 *{{echo|a {{nonexistent|
6495 unused}}}}
6496 *{{echo|b {{nonexistent|
6497 unused}}}}
6498 !!result
6499 <ul><li>a <a href="/index.php?title=Template:Nonexistent&amp;action=edit&amp;redlink=1" class="new" title="Template:Nonexistent (page does not exist)">Template:Nonexistent</a>
6500 </li><li>b <a href="/index.php?title=Template:Nonexistent&amp;action=edit&amp;redlink=1" class="new" title="Template:Nonexistent (page does not exist)">Template:Nonexistent</a>
6501 </li></ul>
6502
6503 !!end
6504
6505 !!test
6506 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
6507 !!input
6508 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
6509 !!result
6510 <p><i>ab</i>c<i>d</i>e
6511 </p>
6512 !!end
6513
6514 !!test
6515 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
6516 (PHP parser generates misnested html)
6517 !! options
6518 disabled
6519 !!input
6520 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
6521 !!result
6522 <p><span><i>a</i></span><i><span>b</span></i><span>c</span><i>d</i><span>e</span></p>
6523 !!end
6524
6525 !!test
6526 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
6527 (PHP parser generates misnested html)
6528 !! options
6529 disabled
6530 !!input
6531 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
6532 !!result
6533 <div><i>a</i></div>
6534 <div><i>b</i>c<i>d</i></div>
6535 <div>e</div>
6536 !!end
6537
6538 !!test
6539 Templates: Ugly nesting: 4. Divs opened/closed across templates
6540 !!input
6541 a<div>b{{echo|c</div>d}}e
6542 !!result
6543 a<div>bc</div>de
6544
6545 !!end
6546
6547 !!test
6548 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
6549 (Parsoid-centric)
6550 !! options
6551 parsoid
6552 !!input
6553 {|
6554 |{{echo|foo</table>}}
6555 |bar
6556 |}
6557 !!result
6558 <table about="#mwt1" typeof="mw:Object/Template ">
6559 <tbody><tr><td>foo</td></tr></tbody></table><span about="#mwt1">
6560 bar</span><span about="#mwt1">
6561 </span>
6562 !!end
6563
6564 !!test
6565 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
6566 (Parsoid-centric)
6567 !! options
6568 parsoid
6569 !!input
6570 <table>
6571 <tr>
6572 <td>
6573 <table>
6574 <tr>
6575 <td>1. {{echo|foo </table>}}</td>
6576 <td> bar </td>
6577 <td>2. {{echo|baz </table>}}</td>
6578 </tr>
6579 <tr>
6580 <td>abc</td>
6581 </tr>
6582 </table>
6583 </td>
6584 </tr>
6585 <tr>
6586 <td>xyz</td>
6587 </tr>
6588 </table>
6589 !!result
6590 <table about="#mwt1" typeof="mw:Object/Template">
6591 <tbody><tr >
6592 <td >
6593 <table >
6594 <tbody><tr >
6595 <td >1. foo </td></tr></tbody></table></td>
6596 <td > bar </td>
6597 <td >2. baz </td></tr></tbody></table><span about="#mwt1">
6598 </span><span about="#mwt1">
6599
6600 abc</span><span about="#mwt1">
6601 </span><span about="#mwt1">
6602 </span><span about="#mwt1">
6603 </span><span about="#mwt1">
6604 </span><span about="#mwt1">
6605
6606 xyz</span><span about="#mwt1">
6607 </span><span about="#mwt1">
6608 </span>
6609 !!end
6610
6611 !! test
6612 Templates: Ugly templates: 3. newline-only template parameter
6613 !! input
6614 foo {{echo|
6615 }}
6616 !! result
6617 <p>foo
6618 </p>
6619 !! end
6620
6621 # This looks like a bug: a single newline triggers p/br for some reason.
6622 !! test
6623 Templates: Ugly templates: 4. newline-only template parameter inconsistency
6624 !! input
6625 {{echo|
6626 }}
6627 !! result
6628 <p><br />
6629 </p>
6630 !! end
6631
6632
6633 !!test
6634 Parser Functions: 1. Simple example
6635 !!input
6636 {{uc:foo}}
6637 !!result
6638 <p>FOO
6639 </p>
6640 !!end
6641
6642 !!test
6643 Parser Functions: 2. Nested use (only outermost should be marked up)
6644 !!input
6645 {{uc:{{lc:FOO}}}}
6646 !!result
6647 <p>FOO
6648 </p>
6649 !!end
6650
6651 ###
6652 ### Pre-save transform tests
6653 ###
6654 !! test
6655 pre-save transform: subst:
6656 !! options
6657 PST
6658 !! input
6659 {{subst:test}}
6660 !! result
6661 This is a test template
6662 !! end
6663
6664 !! test
6665 pre-save transform: normal template
6666 !! options
6667 PST
6668 !! input
6669 {{test}}
6670 !! result
6671 {{test}}
6672 !! end
6673
6674 !! test
6675 pre-save transform: nonexistent template
6676 !! options
6677 PST
6678 !! input
6679 {{thistemplatedoesnotexist}}
6680 !! result
6681 {{thistemplatedoesnotexist}}
6682 !! end
6683
6684
6685 !! test
6686 pre-save transform: subst magic variables
6687 !! options
6688 PST
6689 !! input
6690 {{subst:SITENAME}}
6691 !! result
6692 MediaWiki
6693 !! end
6694
6695 # This is bug 89, which I fixed. -- wtm
6696 !! test
6697 pre-save transform: subst: templates with parameters
6698 !! options
6699 pst
6700 !! input
6701 {{subst:paramtest|param="something else"}}
6702 !! result
6703 This is a test template with parameter "something else"
6704 !! end
6705
6706 !! article
6707 Template:nowikitest
6708 !! text
6709 <nowiki>'''not wiki'''</nowiki>
6710 !! endarticle
6711
6712 !! test
6713 pre-save transform: nowiki in subst (bug 1188)
6714 !! options
6715 pst
6716 !! input
6717 {{subst:nowikitest}}
6718 !! result
6719 <nowiki>'''not wiki'''</nowiki>
6720 !! end
6721
6722
6723 !! article
6724 Template:commenttest
6725 !! text
6726 This template has <!-- a comment --> in it.
6727 !! endarticle
6728
6729 !! test
6730 pre-save transform: comment in subst (bug 1936)
6731 !! options
6732 pst
6733 !! input
6734 {{subst:commenttest}}
6735 !! result
6736 This template has <!-- a comment --> in it.
6737 !! end
6738
6739 !! test
6740 pre-save transform: unclosed tag
6741 !! options
6742 pst noxml
6743 !! input
6744 <nowiki>'''not wiki'''
6745 !! result
6746 <nowiki>'''not wiki'''
6747 !! end
6748
6749 !! test
6750 pre-save transform: mixed tag case
6751 !! options
6752 pst noxml
6753 !! input
6754 <NOwiki>'''not wiki'''</noWIKI>
6755 !! result
6756 <NOwiki>'''not wiki'''</noWIKI>
6757 !! end
6758
6759 !! test
6760 pre-save transform: unclosed comment in <nowiki>
6761 !! options
6762 pst noxml
6763 !! input
6764 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
6765 !! result
6766 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
6767 !!end
6768
6769 !! article
6770 Template:dangerous
6771 !!text
6772 <span onmouseover="alert('crap')">Oh no</span>
6773 !!endarticle
6774
6775 !!test
6776 (confirming safety of fix for subst bug 1936)
6777 !! input
6778 {{Template:dangerous}}
6779 !! result
6780 <p><span>Oh no</span>
6781 </p>
6782 !! end
6783
6784 !! test
6785 pre-save transform: comment containing gallery (bug 5024)
6786 !! options
6787 pst
6788 !! input
6789 <!-- <gallery>data</gallery> -->
6790 !!result
6791 <!-- <gallery>data</gallery> -->
6792 !!end
6793
6794 !! test
6795 pre-save transform: comment containing extension
6796 !! options
6797 pst
6798 !! input
6799 <!-- <tag>data</tag> -->
6800 !!result
6801 <!-- <tag>data</tag> -->
6802 !!end
6803
6804 !! test
6805 pre-save transform: comment containing nowiki
6806 !! options
6807 pst
6808 !! input
6809 <!-- <nowiki>data</nowiki> -->
6810 !!result
6811 <!-- <nowiki>data</nowiki> -->
6812 !!end
6813
6814 !! test
6815 pre-save transform: <noinclude> in subst (bug 3298)
6816 !! options
6817 pst
6818 !! input
6819 {{subst:Includes}}
6820 !! result
6821 Foobar
6822 !! end
6823
6824 !! test
6825 pre-save transform: <onlyinclude> in subst (bug 3298)
6826 !! options
6827 pst
6828 !! input
6829 {{subst:Includes2}}
6830 !! result
6831 Foo
6832 !! end
6833
6834 !! article
6835 Template:SubstTest
6836 !!text
6837 {{<includeonly>subst:</includeonly>Includes}}
6838 !! endarticle
6839
6840 !! article
6841 Template:SafeSubstTest
6842 !! text
6843 {{<includeonly>safesubst:</includeonly>Includes}}
6844 !! endarticle
6845
6846 !! test
6847 bug 22297: safesubst: works during PST
6848 !! options
6849 pst
6850 !! input
6851 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
6852 !! result
6853 FoobarFoobar
6854 !! end
6855
6856 !! test
6857 bug 22297: safesubst: works during normal parse
6858 !! input
6859 {{SafeSubstTest}}
6860 !! result
6861 <p>Foobar
6862 </p>
6863 !! end
6864
6865 !! test:
6866 subst: does not work during normal parse
6867 !! input
6868 {{SubstTest}}
6869 !! result
6870 <p>{{subst:Includes}}
6871 </p>
6872 !! end
6873
6874 !! test
6875 pre-save transform: context links ("pipe trick")
6876 !! options
6877 pst
6878 !! input
6879 [[Article (context)|]]
6880 [[Bar:Article|]]
6881 [[:Bar:Article|]]
6882 [[Bar:Article (context)|]]
6883 [[:Bar:Article (context)|]]
6884 [[|Article]]
6885 [[|Article (context)]]
6886 [[Bar:X (Y) Z|]]
6887 [[:Bar:X (Y) Z|]]
6888 !! result
6889 [[Article (context)|Article]]
6890 [[Bar:Article|Article]]
6891 [[:Bar:Article|Article]]
6892 [[Bar:Article (context)|Article]]
6893 [[:Bar:Article (context)|Article]]
6894 [[Article]]
6895 [[Article (context)]]
6896 [[Bar:X (Y) Z|X (Y) Z]]
6897 [[:Bar:X (Y) Z|X (Y) Z]]
6898 !! end
6899
6900 !! test
6901 pre-save transform: context links ("pipe trick") with interwiki prefix
6902 !! options
6903 pst
6904 !! input
6905 [[interwiki:Article|]]
6906 [[:interwiki:Article|]]
6907 [[interwiki:Bar:Article|]]
6908 [[:interwiki:Bar:Article|]]
6909 !! result
6910 [[interwiki:Article|Article]]
6911 [[:interwiki:Article|Article]]
6912 [[interwiki:Bar:Article|Bar:Article]]
6913 [[:interwiki:Bar:Article|Bar:Article]]
6914 !! end
6915
6916 !! test
6917 pre-save transform: context links ("pipe trick") with parens in title
6918 !! options
6919 pst title=[[Somearticle (context)]]
6920 !! input
6921 [[|Article]]
6922 !! result
6923 [[Article (context)|Article]]
6924 !! end
6925
6926 !! test
6927 pre-save transform: context links ("pipe trick") with comma in title
6928 !! options
6929 pst title=[[Someplace, Somewhere]]
6930 !! input
6931 [[|Otherplace]]
6932 [[Otherplace, Elsewhere|]]
6933 [[Otherplace, Elsewhere, Anywhere|]]
6934 !! result
6935 [[Otherplace, Somewhere|Otherplace]]
6936 [[Otherplace, Elsewhere|Otherplace]]
6937 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
6938 !! end
6939
6940 !! test
6941 pre-save transform: context links ("pipe trick") with parens and comma
6942 !! options
6943 pst title=[[Someplace (IGNORED), Somewhere]]
6944 !! input
6945 [[|Otherplace]]
6946 [[Otherplace (place), Elsewhere|]]
6947 !! result
6948 [[Otherplace, Somewhere|Otherplace]]
6949 [[Otherplace (place), Elsewhere|Otherplace]]
6950 !! end
6951
6952 !! test
6953 pre-save transform: context links ("pipe trick") with comma and parens
6954 !! options
6955 pst title=[[Who, me? (context)]]
6956 !! input
6957 [[|Yes, you.]]
6958 [[Me, Myself, and I (1937 song)|]]
6959 !! result
6960 [[Yes, you. (context)|Yes, you.]]
6961 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
6962 !! end
6963
6964 !! test
6965 pre-save transform: context links ("pipe trick") with namespace
6966 !! options
6967 pst title=[[Ns:Somearticle]]
6968 !! input
6969 [[|Article]]
6970 !! result
6971 [[Ns:Article|Article]]
6972 !! end
6973
6974 !! test
6975 pre-save transform: context links ("pipe trick") with namespace and parens
6976 !! options
6977 pst title=[[Ns:Somearticle (context)]]
6978 !! input
6979 [[|Article]]
6980 !! result
6981 [[Ns:Article (context)|Article]]
6982 !! end
6983
6984 !! test
6985 pre-save transform: context links ("pipe trick") with namespace and comma
6986 !! options
6987 pst title=[[Ns:Somearticle, Context, Whatever]]
6988 !! input
6989 [[|Article]]
6990 !! result
6991 [[Ns:Article, Context, Whatever|Article]]
6992 !! end
6993
6994 !! test
6995 pre-save transform: context links ("pipe trick") with namespace, comma and parens
6996 !! options
6997 pst title=[[Ns:Somearticle, Context (context)]]
6998 !! input
6999 [[|Article]]
7000 !! result
7001 [[Ns:Article (context)|Article]]
7002 !! end
7003
7004 !! test
7005 pre-save transform: context links ("pipe trick") with namespace, parens and comma
7006 !! options
7007 pst title=[[Ns:Somearticle (IGNORED), Context]]
7008 !! input
7009 [[|Article]]
7010 !! result
7011 [[Ns:Article, Context|Article]]
7012 !! end
7013
7014 !! test
7015 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
7016 !! options
7017 pst
7018 !! input
7019 [[Article(context)|]]
7020 [[Bar:Article(context)|]]
7021 [[:Bar:Article(context)|]]
7022 [[|Article(context)]]
7023 [[Bar:X(Y)Z|]]
7024 [[:Bar:X(Y)Z|]]
7025 !! result
7026 [[Article(context)|Article]]
7027 [[Bar:Article(context)|Article]]
7028 [[:Bar:Article(context)|Article]]
7029 [[Article(context)]]
7030 [[Bar:X(Y)Z|X(Y)Z]]
7031 [[:Bar:X(Y)Z|X(Y)Z]]
7032 !! end
7033
7034 !! test
7035 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
7036 !! options
7037 pst
7038 !! input
7039 [[Article (context)|]]
7040 [[Bar:Article (context)|]]
7041 [[:Bar:Article (context)|]]
7042 [[|Article (context)]]
7043 [[Bar:X (Y) Z|]]
7044 [[:Bar:X (Y) Z|]]
7045 !! result
7046 [[Article (context)|Article]]
7047 [[Bar:Article (context)|Article]]
7048 [[:Bar:Article (context)|Article]]
7049 [[Article (context)]]
7050 [[Bar:X (Y) Z|X (Y) Z]]
7051 [[:Bar:X (Y) Z|X (Y) Z]]
7052 !! end
7053
7054 !! test
7055 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
7056 !! options
7057 pst
7058 !! input
7059 [[Article(context)|]]
7060 [[Bar:Article(context)|]]
7061 [[:Bar:Article(context)|]]
7062 [[|Article(context)]]
7063 [[Bar:X(Y)Z|]]
7064 [[:Bar:X(Y)Z|]]
7065 !! result
7066 [[Article(context)|Article]]
7067 [[Bar:Article(context)|Article]]
7068 [[:Bar:Article(context)|Article]]
7069 [[Article(context)]]
7070 [[Bar:X(Y)Z|X(Y)Z]]
7071 [[:Bar:X(Y)Z|X(Y)Z]]
7072 !! end
7073
7074 !! test
7075 pre-save transform: context links ("pipe trick") with commas (bug 21660)
7076 !! options
7077 pst
7078 !! input
7079 [[Article (context), context|]]
7080 [[Article (context),context|]]
7081 [[Bar:Article (context), context|]]
7082 [[Bar:Article (context),context|]]
7083 [[:Bar:Article (context), context|]]
7084 [[:Bar:Article (context),context|]]
7085 !! result
7086 [[Article (context), context|Article]]
7087 [[Article (context),context|Article]]
7088 [[Bar:Article (context), context|Article]]
7089 [[Bar:Article (context),context|Article]]
7090 [[:Bar:Article (context), context|Article]]
7091 [[:Bar:Article (context),context|Article]]
7092 !! end
7093
7094 !! test
7095 pre-save transform: trim trailing empty lines
7096 !! options
7097 pst
7098 !! input
7099 Empty lines are trimmed
7100
7101
7102
7103
7104 !! result
7105 Empty lines are trimmed
7106 !! end
7107
7108 !! test
7109 pre-save transform: Signature expansion
7110 !! options
7111 pst
7112 !! input
7113 * ~~~
7114 * <noinclude>~~~</noinclude>
7115 * <includeonly>~~~</includeonly>
7116 * <onlyinclude>~~~</onlyinclude>
7117 !! result
7118 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
7119 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
7120 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
7121 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
7122 !! end
7123
7124
7125 !! test
7126 pre-save transform: Signature expansion in nowiki tags (bug 93)
7127 !! options
7128 pst disabled
7129 !! input
7130 Shall not expand:
7131
7132 <nowiki>~~~~</nowiki>
7133
7134 <includeonly><nowiki>~~~~</nowiki></includeonly>
7135
7136 <noinclude><nowiki>~~~~</nowiki></noinclude>
7137
7138 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
7139
7140 {{subst:Foo}} shall be converted to FOO
7141
7142 As well as inside noinclude/onlyinclude
7143 <noinclude>{{subst:Foo}}</noinclude>
7144 <onlyinclude>{{subst:Foo}}</onlyinclude>
7145
7146 But not inside includeonly
7147 <includeonly>{{subst:Foo}}</includeonly>
7148 !! result
7149 Shall not expand:
7150
7151 <nowiki>~~~~</nowiki>
7152
7153 <includeonly><nowiki>~~~~</nowiki></includeonly>
7154
7155 <noinclude><nowiki>~~~~</nowiki></noinclude>
7156
7157 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
7158
7159 FOO shall be converted to FOO
7160
7161 As well as inside noinclude/onlyinclude
7162 <noinclude>FOO</noinclude>
7163 <onlyinclude>FOO</onlyinclude>
7164
7165 But not inside includeonly
7166 <includeonly>{{subst:Foo}}</includeonly>
7167 !! end
7168
7169 ###
7170 ### Message transform tests
7171 ###
7172 !! test
7173 message transform: magic variables
7174 !! options
7175 msg
7176 !! input
7177 {{SITENAME}}
7178 !! result
7179 MediaWiki
7180 !! end
7181
7182 !! test
7183 message transform: should not transform wiki markup
7184 !! options
7185 msg
7186 !! input
7187 ''test''
7188 !! result
7189 ''test''
7190 !! end
7191
7192 !! test
7193 message transform: <noinclude> in transcluded template (bug 4926)
7194 !! options
7195 msg
7196 !! input
7197 {{Includes}}
7198 !! result
7199 Foobar
7200 !! end
7201
7202 !! test
7203 message transform: <onlyinclude> in transcluded template (bug 4926)
7204 !! options
7205 msg
7206 !! input
7207 {{Includes2}}
7208 !! result
7209 Foo
7210 !! end
7211
7212 !! test
7213 {{#special:}} page name, known
7214 !! options
7215 msg
7216 !! input
7217 {{#special:Recentchanges}}
7218 !! result
7219 Special:RecentChanges
7220 !! end
7221
7222 !! test
7223 {{#special:}} page name with subpage, known
7224 !! options
7225 msg
7226 !! input
7227 {{#special:Recentchanges/param}}
7228 !! result
7229 Special:RecentChanges/param
7230 !! end
7231
7232 !! test
7233 {{#special:}} page name, unknown
7234 !! options
7235 msg
7236 !! input
7237 {{#special:foobarnonexistent}}
7238 !! result
7239 No such special page
7240 !! end
7241
7242 !! test
7243 {{#speciale:}} page name, known
7244 !! options
7245 msg
7246 !! input
7247 {{#speciale:Recentchanges}}
7248 !! result
7249 Special:RecentChanges
7250 !! end
7251
7252 !! test
7253 {{#speciale:}} page name with subpage, known
7254 !! options
7255 msg
7256 !! input
7257 {{#speciale:Recentchanges/param}}
7258 !! result
7259 Special:RecentChanges/param
7260 !! end
7261
7262 !! test
7263 {{#speciale:}} page name, unknown
7264 !! options
7265 msg
7266 !! input
7267 {{#speciale:foobarnonexistent}}
7268 !! result
7269 No_such_special_page
7270 !! end
7271
7272 ###
7273 ### Images
7274 ###
7275 !! test
7276 Simple image
7277 !! input
7278 [[Image:foobar.jpg]]
7279 !! result
7280 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7281 </p>
7282 !! end
7283
7284 !! test
7285 Right-aligned image
7286 !! input
7287 [[Image:foobar.jpg|right]]
7288 !! result
7289 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
7290
7291 !! end
7292
7293 !! test
7294 Simple image (using File: namespace, now canonical)
7295 !! input
7296 [[File:foobar.jpg]]
7297 !! result
7298 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7299 </p>
7300 !! end
7301
7302 !! test
7303 Image with caption
7304 !! input
7305 [[Image:foobar.jpg|right|Caption text]]
7306 !! result
7307 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption text"><img alt="Caption text" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
7308
7309 !! end
7310
7311 !! test
7312 Image with empty attribute
7313 !! input
7314 [[Image:foobar.jpg|right||Caption text]]
7315 !! result
7316 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption text"><img alt="Caption text" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
7317
7318 !! end
7319
7320 !! test
7321 Image with link tails
7322 !! input
7323 123[[Image:foobar.jpg]]456
7324 123[[Image:foobar.jpg|right]]456
7325 123[[Image:foobar.jpg|thumb]]456
7326 !! result
7327 <p>123<a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>456
7328 </p>
7329 123<div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>456
7330 123<div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div></div></div></div>456
7331
7332 !! end
7333
7334 !! test
7335 Image with multiple captions -- only last one is accepted
7336 !! input
7337 [[Image:foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
7338 !! result
7339 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption3 - accepted"><img alt="Caption3 - accepted" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
7340
7341 !! end
7342
7343 !! test
7344 Image with width attribute at different positions
7345 !! input
7346 [[Image:foobar.jpg|200px|right|Caption]]
7347 [[Image:foobar.jpg|right|200px|Caption]]
7348 [[Image:foobar.jpg|right|Caption|200px]]
7349 !! result
7350 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption"><img alt="Caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a></div>
7351 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption"><img alt="Caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a></div>
7352 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption"><img alt="Caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a></div>
7353
7354 !! end
7355
7356 !! test
7357 Image with link parameter, wiki target
7358 !! input
7359 [[Image:foobar.jpg|link=Target page]]
7360 !! result
7361 <p><a href="/wiki/Target_page" title="Target page"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7362 </p>
7363 !! end
7364
7365 !! test
7366 Image with link parameter, URL target
7367 !! input
7368 [[Image:foobar.jpg|link=http://example.com/]]
7369 !! result
7370 <p><a href="http://example.com/" rel="nofollow"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7371 </p>
7372 !! end
7373
7374 !! test
7375 Image with link parameter, wgExternalLinkTarget
7376 !! input
7377 [[Image:foobar.jpg|link=http://example.com/]]
7378 !! config
7379 wgExternalLinkTarget='foobar'
7380 !! result
7381 <p><a href="http://example.com/" target="foobar" rel="nofollow"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7382 </p>
7383 !! end
7384
7385 !! test
7386 Image with link parameter, wgNoFollowLinks set to false
7387 !! input
7388 [[Image:foobar.jpg|link=http://example.com/]]
7389 !! config
7390 wgNoFollowLinks=false
7391 !! result
7392 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7393 </p>
7394 !! end
7395
7396 !! test
7397 Image with link parameter, wgNoFollowDomainExceptions
7398 !! input
7399 [[Image:foobar.jpg|link=http://example.com/]]
7400 !! config
7401 wgNoFollowDomainExceptions='example.com'
7402 !! result
7403 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7404 </p>
7405 !! end
7406
7407 !! test
7408 Image with link parameter, wgExternalLinkTarget, unnamed parameter
7409 !! input
7410 [[Image:foobar.jpg|link=http://example.com/|Title]]
7411 !! config
7412 wgExternalLinkTarget='foobar'
7413 !! result
7414 <p><a href="http://example.com/" title="Title" target="foobar" rel="nofollow"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7415 </p>
7416 !! end
7417
7418 !! test
7419 Image with empty link parameter
7420 !! input
7421 [[Image:foobar.jpg|link=]]
7422 !! result
7423 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
7424 </p>
7425 !! end
7426
7427 !! test
7428 Image with link parameter (wiki target) and unnamed parameter
7429 !! input
7430 [[Image:foobar.jpg|link=Target page|Title]]
7431 !! result
7432 <p><a href="/wiki/Target_page" title="Title"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7433 </p>
7434 !! end
7435
7436 !! test
7437 Image with link parameter (URL target) and unnamed parameter
7438 !! input
7439 [[Image:foobar.jpg|link=http://example.com/|Title]]
7440 !! result
7441 <p><a href="http://example.com/" title="Title" rel="nofollow"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7442 </p>
7443 !! end
7444
7445 !! test
7446 Thumbnail image with link parameter
7447 !! options
7448 php
7449 !! input
7450 [[Image:foobar.jpg|thumb|link=http://example.com/|Title]]
7451 !! result
7452 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="http://example.com/"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Title</div></div></div>
7453
7454 !! end
7455
7456 !! test
7457 Manually-specified thumbnail image
7458 !! options
7459 php
7460 !! input
7461 [[Image:Foobar.jpg|thumb=Thumb.png|Title]]
7462 !! result
7463 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="/wiki/File:Foobar.jpg"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Title</div></div></div>
7464
7465 !! end
7466
7467 !! test
7468 Manually-specified thumbnail image with explicit link to wiki page
7469 !! options
7470 php
7471 !! input
7472 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|Title]]
7473 !! result
7474 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="/wiki/Main_Page" title="Main Page"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Title</div></div></div>
7475
7476 !! end
7477
7478 !! test
7479 Manually-specified thumbnail image with explicit link to url
7480 !! options
7481 php
7482 !! input
7483 [[Image:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
7484 !! result
7485 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="http://example.com"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Title</div></div></div>
7486
7487 !! end
7488
7489 !! test
7490 Manually-specified thumbnail image with explicit no link
7491 !! options
7492 php
7493 !! input
7494 [[Image:Foobar.jpg|thumb=Thumb.png|link=|Title]]
7495 !! result
7496 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Title</div></div></div>
7497
7498 !! end
7499
7500 !! test
7501 Manually-specified thumbnail image with explicit link and alt text
7502 !! options
7503 php
7504 !! input
7505 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|alt=alttext|Title]]
7506 !! result
7507 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="/wiki/Main_Page" title="Main Page"><img alt="alttext" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Title</div></div></div>
7508
7509 !! end
7510
7511 !! test
7512 Image with frame and link
7513 !! input
7514 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
7515 !! result
7516 <div class="thumb tleft"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption">This is a test image <a href="/wiki/Main_Page" title="Main Page">Main Page</a></div></div></div>
7517
7518 !! end
7519
7520 !! test
7521 Image with frame and link and explicit alt
7522 !! input
7523 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
7524 !! result
7525 <div class="thumb tleft"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Altitude" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption">This is a test image <a href="/wiki/Main_Page" title="Main Page">Main Page</a></div></div></div>
7526
7527 !! end
7528
7529 !! test
7530 Image with wiki markup in implicit alt
7531 !! input
7532 [[Image:Foobar.jpg|testing '''bold''' in alt]]
7533 !! result
7534 <p><a href="/wiki/File:Foobar.jpg" class="image" title="testing bold in alt"><img alt="testing bold in alt" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7535 </p>
7536 !! end
7537
7538 !! test
7539 Image with wiki markup in explicit alt
7540 !! input
7541 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
7542 !! result
7543 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="testing bold in alt" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7544 </p>
7545 !! end
7546
7547 !! test
7548 Link to image page- image page normally doesn't exists, hence edit link
7549 Add test with existing image page
7550 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
7551 !! input
7552 [[:Image:test]]
7553 !! result
7554 <p><a href="/index.php?title=File:Test&amp;action=edit&amp;redlink=1" class="new" title="File:Test (page does not exist)">Image:test</a>
7555 </p>
7556 !! end
7557
7558 !! test
7559 bug 18784 Link to non-existent image page with caption should use caption as link text
7560 !! input
7561 [[:Image:test|caption]]
7562 !! result
7563 <p><a href="/index.php?title=File:Test&amp;action=edit&amp;redlink=1" class="new" title="File:Test (page does not exist)">caption</a>
7564 </p>
7565 !! end
7566
7567 !! test
7568 Frameless image caption with a free URL
7569 !! input
7570 [[Image:foobar.jpg|http://example.com]]
7571 !! result
7572 <p><a href="/wiki/File:Foobar.jpg" class="image" title="http://example.com"><img alt="http://example.com" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7573 </p>
7574 !! end
7575
7576 !! test
7577 Thumbnail image caption with a free URL
7578 !! input
7579 [[Image:foobar.jpg|thumb|http://example.com]]
7580 !! result
7581 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div></div></div>
7582
7583 !! end
7584
7585 !! test
7586 Thumbnail image caption with a free URL and explicit alt
7587 !! input
7588 [[Image:foobar.jpg|thumb|http://example.com|alt=Alteration]]
7589 !! result
7590 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Alteration" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div></div></div>
7591
7592 !! end
7593
7594 !! test
7595 BUG 1887: A ISBN with a thumbnail
7596 !! input
7597 [[Image:foobar.jpg|thumb|ISBN 1235467890]]
7598 !! result
7599 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div><a href="/wiki/Special:BookSources/1235467890" class="internal mw-magiclink-isbn">ISBN 1235467890</a></div></div></div>
7600
7601 !! end
7602
7603 !! test
7604 BUG 1887: A RFC with a thumbnail
7605 !! input
7606 [[Image:foobar.jpg|thumb|This is RFC 12354]]
7607 !! result
7608 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>This is <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc12354">RFC 12354</a></div></div></div>
7609
7610 !! end
7611
7612 !! test
7613 BUG 1887: A mailto link with a thumbnail
7614 !! input
7615 [[Image:foobar.jpg|thumb|Please mailto:nobody@example.com]]
7616 !! result
7617 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Please <a rel="nofollow" class="external free" href="mailto:nobody@example.com">mailto:nobody@example.com</a></div></div></div>
7618
7619 !! end
7620
7621 # Pending resolution to bug 368
7622 !! test
7623 BUG 648: Frameless image caption with a link
7624 !! input
7625 [[Image:foobar.jpg|text with a [[link]] in it]]
7626 !! result
7627 <p><a href="/wiki/File:Foobar.jpg" class="image" title="text with a link in it"><img alt="text with a link in it" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7628 </p>
7629 !! end
7630
7631 !! test
7632 BUG 648: Frameless image caption with a link (suffix)
7633 !! input
7634 [[Image:foobar.jpg|text with a [[link]]foo in it]]
7635 !! result
7636 <p><a href="/wiki/File:Foobar.jpg" class="image" title="text with a linkfoo in it"><img alt="text with a linkfoo in it" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7637 </p>
7638 !! end
7639
7640 !! test
7641 BUG 648: Frameless image caption with an interwiki link
7642 !! input
7643 [[Image:foobar.jpg|text with a [[MeatBall:Link]] in it]]
7644 !! result
7645 <p><a href="/wiki/File:Foobar.jpg" class="image" title="text with a MeatBall:Link in it"><img alt="text with a MeatBall:Link in it" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7646 </p>
7647 !! end
7648
7649 !! test
7650 BUG 648: Frameless image caption with a piped interwiki link
7651 !! input
7652 [[Image:foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
7653 !! result
7654 <p><a href="/wiki/File:Foobar.jpg" class="image" title="text with a link in it"><img alt="text with a link in it" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7655 </p>
7656 !! end
7657
7658 !! test
7659 Escape HTML special chars in image alt text
7660 !! input
7661 [[Image:foobar.jpg|& < > "]]
7662 !! result
7663 <p><a href="/wiki/File:Foobar.jpg" class="image" title="&amp; &lt; &gt; &quot;"><img alt="&amp; &lt; &gt; &quot;" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7664 </p>
7665 !! end
7666
7667 !! test
7668 BUG 499: Alt text should have &#1234;, not &amp;1234;
7669 !! input
7670 [[Image:foobar.jpg|&#9792;]]
7671 !! result
7672 <p><a href="/wiki/File:Foobar.jpg" class="image" title="♀"><img alt="♀" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7673 </p>
7674 !! end
7675
7676 !! test
7677 Broken image caption with link
7678 !! input
7679 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
7680 !! result
7681 <p>[[Image:Foobar.jpg|thumb|This is a broken caption. But <a href="/wiki/Main_Page" title="Main Page">this</a> is just an ordinary link.
7682 </p>
7683 !! end
7684
7685 !! test
7686 Image caption containing another image
7687 !! input
7688 [[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]]
7689 !! result
7690 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>This is a caption with another <a href="/index.php?title=Special:Upload&amp;wpDestFile=Icon.png" class="new" title="File:Icon.png">image</a> inside it!</div></div></div>
7691
7692 !! end
7693
7694 !! test
7695 Image caption containing a newline
7696 !! input
7697 [[Image:Foobar.jpg|This
7698 *is some text]]
7699 !! result
7700 <p><a href="/wiki/File:Foobar.jpg" class="image" title="This *is some text"><img alt="This *is some text" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7701 </p>
7702 !!end
7703
7704 !!test
7705 Parsoid: Image caption containing leading space
7706 (The leading space should not trigger nowiki escaping in wt2wt mode)
7707 !! input
7708 [[Image:Foobar.jpg|thumb| bar]]
7709 !! result
7710 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>bar</div></div></div>
7711
7712 !!end
7713
7714 !! test
7715 Bug 3090: External links other than http: in image captions
7716 !! input
7717 [[Image:Foobar.jpg|thumb|200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
7718 !! result
7719 <div class="thumb tright"><div class="thumbinner" style="width:202px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>This caption has <a rel="nofollow" class="external text" href="irc://example.net">irc</a> and <a rel="nofollow" class="external text" href="https://example.com">Secure</a> ext links in it.</div></div></div>
7720
7721 !! end
7722
7723 !! test
7724 Custom class
7725 !! input
7726 [[Image:foobar.jpg|a|class=b]]
7727 !! result
7728 <p><a href="/wiki/File:Foobar.jpg" class="image" title="a"><img alt="a" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="b" /></a>
7729 </p>
7730 !! end
7731
7732 !! test
7733 Localized image handling (1).
7734 !! options
7735 language=es
7736 !! input
7737 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
7738 !! result
7739 <div class="floatleft"><a href="/wiki/Foo" title="caption"><img alt="caption" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
7740
7741 !! end
7742
7743 !! test
7744 Localized image handling (2).
7745 !! options
7746 language=es
7747 !! input
7748 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
7749 !! result
7750 <div class="thumb tleft"><div class="thumbinner" style="width:182px;"><a href="/wiki/Foo" title="Foo"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/Archivo:Foobar.jpg" class="internal" title="Aumentar"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>caption</div></div></div>
7751
7752 !! end
7753
7754 !! test
7755 "border", "frameless" and "class" attributes on an image.
7756 !! input
7757 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
7758 !! result
7759 <p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="extra thumbborder" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a>
7760 </p>
7761 !! end
7762
7763 !! article
7764 File:Barfoo.jpg
7765 !! text
7766 #REDIRECT [[File:Barfoo.jpg]]
7767 !! endarticle
7768
7769 !! test
7770 Redirected image
7771 !! input
7772 [[Image:Barfoo.jpg]]
7773 !! result
7774 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
7775 </p>
7776 !! end
7777
7778 !! test
7779 Missing image with uploads disabled
7780 !! options
7781 wgEnableUploads=0
7782 !! input
7783 [[Image:Foobaz.jpg]]
7784 !! result
7785 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
7786 </p>
7787 !! end
7788
7789
7790 ###
7791 ### Subpages
7792 ###
7793 !! article
7794 Subpage test/subpage
7795 !! text
7796 foo
7797 !! endarticle
7798
7799 !! test
7800 Subpage link
7801 !! options
7802 subpage title=[[Subpage test]]
7803 !! input
7804 [[/subpage]]
7805 !! result
7806 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
7807 </p>
7808 !! end
7809
7810 !! test
7811 Subpage noslash link
7812 !! options
7813 subpage title=[[Subpage test]]
7814 !!input
7815 [[/subpage/]]
7816 !! result
7817 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
7818 </p>
7819 !! end
7820
7821 !! test
7822 Disabled subpages
7823 !! input
7824 [[/subpage]]
7825 !! result
7826 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
7827 </p>
7828 !! end
7829
7830 !! test
7831 BUG 561: {{/Subpage}}
7832 !! options
7833 subpage title=[[Page]]
7834 !! input
7835 {{/Subpage}}
7836 !! result
7837 <p><a href="/index.php?title=Page/Subpage&amp;action=edit&amp;redlink=1" class="new" title="Page/Subpage (page does not exist)">Page/Subpage</a>
7838 </p>
7839 !! end
7840
7841 ###
7842 ### Categories
7843 ###
7844 !! article
7845 Category:MediaWiki User's Guide
7846 !! text
7847 blah
7848 !! endarticle
7849
7850 !! test
7851 Link to category
7852 !! input
7853 [[:Category:MediaWiki User's Guide]]
7854 !! result
7855 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
7856 </p>
7857 !! end
7858
7859 !! test
7860 Simple category
7861 !! options
7862 cat
7863 !! input
7864 [[Category:MediaWiki User's Guide]]
7865 !! result
7866 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
7867 !! end
7868
7869 !! test
7870 PAGESINCATEGORY invalid title fatal (r33546 fix)
7871 !! input
7872 {{PAGESINCATEGORY:<bogus>}}
7873 !! result
7874 <p>0
7875 </p>
7876 !! end
7877
7878 !! test
7879 Category with different sort key
7880 !! options
7881 cat
7882 !! input
7883 [[Category:MediaWiki User's Guide|Foo]]
7884 !! result
7885 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
7886 !! end
7887
7888 !! test
7889 Category with identical sort key
7890 !! options
7891 cat
7892 !! input
7893 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
7894 !! result
7895 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
7896 !! end
7897
7898 !! test
7899 Category with empty sort key
7900 !! options
7901 cat
7902 pst
7903 !! input
7904 [[Category:MediaWiki User's Guide|]]
7905 !! result
7906 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
7907 !! end
7908
7909 !! test
7910 Category with empty sort key and parentheses
7911 !! options
7912 cat
7913 pst
7914 !! input
7915 [[Category:Foo (bar)|]]
7916 !! result
7917 [[Category:Foo (bar)|Foo]]
7918 !! end
7919
7920 !! test
7921 Category with link tail
7922 !! options
7923 cat
7924 pst
7925 !! input
7926 123[[Category:Foo]]456
7927 !! result
7928 123[[Category:Foo]]456
7929 !! end
7930
7931 !! test
7932 Category with template
7933 !! options
7934 cat
7935 pst
7936 !! input
7937 [[Category:{{echo|Foo}}]]
7938 !! result
7939 [[Category:{{echo|Foo}}]]
7940 !! end
7941
7942 !! test
7943 Category with template in sort key
7944 !! options
7945 cat
7946 pst
7947 !! input
7948 [[Category:Foo|{{echo|Bar}}]]
7949 !! result
7950 [[Category:Foo|{{echo|Bar}}]]
7951 !! end
7952
7953 !! test
7954 Category with template in sort key and title
7955 !! options
7956 cat
7957 pst
7958 !! input
7959 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
7960 !! result
7961 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
7962 !! end
7963
7964 !! test
7965 Category / paragraph interactions
7966 !! input
7967 Foo [[Category:Baz]] Bar
7968
7969 Foo [[Category:Baz]]
7970 Bar
7971
7972 Foo
7973 [[Category:Baz]]
7974 Bar
7975
7976 Foo
7977 [[Category:Baz]] Bar
7978
7979 Foo
7980 [[Category:Baz]]
7981 [[Category:Baz]]
7982 [[Category:Baz]]
7983 Bar
7984
7985 [[Category:Baz]]
7986 [[Category:Baz]]
7987 [[Category:Baz]]
7988
7989 [[Category:Baz]]
7990 {{echo|[[Category:Baz]]}}
7991 [[Category:Baz]]
7992 !! result
7993 <p>Foo Bar
7994 </p><p>Foo
7995 Bar
7996 </p><p>Foo
7997 Bar
7998 </p><p>Foo Bar
7999 </p><p>Foo
8000 Bar
8001 </p>
8002 !! end
8003
8004 ###
8005 ### Inter-language links
8006 ###
8007 !! test
8008 Inter-language links
8009 !! options
8010 ill
8011 !! input
8012 [[es:Alimento]]
8013 [[fr:Nourriture]]
8014 [[zh:&#39135;&#21697;]]
8015 !! result
8016 es:Alimento fr:Nourriture zh:食品
8017 !! end
8018
8019 !! test
8020 Duplicate interlanguage links (bug 24502)
8021 !! options
8022 ill
8023 !! input
8024 [[es:1]]
8025 [[es:2]]
8026 [[fr:1]]
8027 [[fr:2]]
8028 !! result
8029 es:1 fr:1
8030 !! end
8031
8032 ###
8033 ### Sections
8034 ###
8035 !! test
8036 Basic section headings
8037 !! input
8038 == Headline 1 ==
8039 Some text
8040
8041 ==Headline 2==
8042 More
8043 ===Smaller headline===
8044 Blah blah
8045 !! result
8046 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Headline 1">edit</a>]</span> <span class="mw-headline" id="Headline_1">Headline 1</span></h2>
8047 <p>Some text
8048 </p>
8049 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Headline 2">edit</a>]</span> <span class="mw-headline" id="Headline_2">Headline 2</span></h2>
8050 <p>More
8051 </p>
8052 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Smaller headline">edit</a>]</span> <span class="mw-headline" id="Smaller_headline">Smaller headline</span></h3>
8053 <p>Blah blah
8054 </p>
8055 !! end
8056
8057 !! test
8058 Section headings with TOC
8059 !! input
8060 == Headline 1 ==
8061 === Subheadline 1 ===
8062 ===== Skipping a level =====
8063 ====== Skipping a level ======
8064
8065 == Headline 2 ==
8066 Some text
8067 ===Another headline===
8068 !! result
8069 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8070 <ul>
8071 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
8072 <ul>
8073 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
8074 <ul>
8075 <li class="toclevel-3 tocsection-3"><a href="#Skipping_a_level"><span class="tocnumber">1.1.1</span> <span class="toctext">Skipping a level</span></a>
8076 <ul>
8077 <li class="toclevel-4 tocsection-4"><a href="#Skipping_a_level_2"><span class="tocnumber">1.1.1.1</span> <span class="toctext">Skipping a level</span></a></li>
8078 </ul>
8079 </li>
8080 </ul>
8081 </li>
8082 </ul>
8083 </li>
8084 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
8085 <ul>
8086 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
8087 </ul>
8088 </li>
8089 </ul>
8090 </td></tr></table>
8091 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Headline 1">edit</a>]</span> <span class="mw-headline" id="Headline_1">Headline 1</span></h2>
8092 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Subheadline 1">edit</a>]</span> <span class="mw-headline" id="Subheadline_1">Subheadline 1</span></h3>
8093 <h5><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Skipping a level">edit</a>]</span> <span class="mw-headline" id="Skipping_a_level">Skipping a level</span></h5>
8094 <h6><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Skipping a level">edit</a>]</span> <span class="mw-headline" id="Skipping_a_level_2">Skipping a level</span></h6>
8095 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Headline 2">edit</a>]</span> <span class="mw-headline" id="Headline_2">Headline 2</span></h2>
8096 <p>Some text
8097 </p>
8098 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: Another headline">edit</a>]</span> <span class="mw-headline" id="Another_headline">Another headline</span></h3>
8099
8100 !! end
8101
8102 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
8103 !! test
8104 Handling of sections up to level 6 and beyond
8105 !! input
8106 = Level 1 Heading=
8107 == Level 2 Heading==
8108 === Level 3 Heading===
8109 ==== Level 4 Heading====
8110 ===== Level 5 Heading=====
8111 ====== Level 6 Heading======
8112 ======= Level 7 Heading=======
8113 ======== Level 8 Heading========
8114 ========= Level 9 Heading=========
8115 ========== Level 10 Heading==========
8116 !! result
8117 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8118 <ul>
8119 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
8120 <ul>
8121 <li class="toclevel-2 tocsection-2"><a href="#Level_2_Heading"><span class="tocnumber">1.1</span> <span class="toctext">Level 2 Heading</span></a>
8122 <ul>
8123 <li class="toclevel-3 tocsection-3"><a href="#Level_3_Heading"><span class="tocnumber">1.1.1</span> <span class="toctext">Level 3 Heading</span></a>
8124 <ul>
8125 <li class="toclevel-4 tocsection-4"><a href="#Level_4_Heading"><span class="tocnumber">1.1.1.1</span> <span class="toctext">Level 4 Heading</span></a>
8126 <ul>
8127 <li class="toclevel-5 tocsection-5"><a href="#Level_5_Heading"><span class="tocnumber">1.1.1.1.1</span> <span class="toctext">Level 5 Heading</span></a>
8128 <ul>
8129 <li class="toclevel-6 tocsection-6"><a href="#Level_6_Heading"><span class="tocnumber">1.1.1.1.1.1</span> <span class="toctext">Level 6 Heading</span></a></li>
8130 <li class="toclevel-6 tocsection-7"><a href="#.3D_Level_7_Heading.3D"><span class="tocnumber">1.1.1.1.1.2</span> <span class="toctext">= Level 7 Heading=</span></a></li>
8131 <li class="toclevel-6 tocsection-8"><a href="#.3D.3D_Level_8_Heading.3D.3D"><span class="tocnumber">1.1.1.1.1.3</span> <span class="toctext">== Level 8 Heading==</span></a></li>
8132 <li class="toclevel-6 tocsection-9"><a href="#.3D.3D.3D_Level_9_Heading.3D.3D.3D"><span class="tocnumber">1.1.1.1.1.4</span> <span class="toctext">=== Level 9 Heading===</span></a></li>
8133 <li class="toclevel-6 tocsection-10"><a href="#.3D.3D.3D.3D_Level_10_Heading.3D.3D.3D.3D"><span class="tocnumber">1.1.1.1.1.5</span> <span class="toctext">==== Level 10 Heading====</span></a></li>
8134 </ul>
8135 </li>
8136 </ul>
8137 </li>
8138 </ul>
8139 </li>
8140 </ul>
8141 </li>
8142 </ul>
8143 </li>
8144 </ul>
8145 </td></tr></table>
8146 <h1><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Level 1 Heading">edit</a>]</span> <span class="mw-headline" id="Level_1_Heading">Level 1 Heading</span></h1>
8147 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Level 2 Heading">edit</a>]</span> <span class="mw-headline" id="Level_2_Heading">Level 2 Heading</span></h2>
8148 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Level 3 Heading">edit</a>]</span> <span class="mw-headline" id="Level_3_Heading">Level 3 Heading</span></h3>
8149 <h4><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Level 4 Heading">edit</a>]</span> <span class="mw-headline" id="Level_4_Heading">Level 4 Heading</span></h4>
8150 <h5><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Level 5 Heading">edit</a>]</span> <span class="mw-headline" id="Level_5_Heading">Level 5 Heading</span></h5>
8151 <h6><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: Level 6 Heading">edit</a>]</span> <span class="mw-headline" id="Level_6_Heading">Level 6 Heading</span></h6>
8152 <h6><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=7" title="Edit section: = Level 7 Heading=">edit</a>]</span> <span class="mw-headline" id=".3D_Level_7_Heading.3D">= Level 7 Heading=</span></h6>
8153 <h6><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=8" title="Edit section: == Level 8 Heading==">edit</a>]</span> <span class="mw-headline" id=".3D.3D_Level_8_Heading.3D.3D">== Level 8 Heading==</span></h6>
8154 <h6><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=9" title="Edit section: === Level 9 Heading===">edit</a>]</span> <span class="mw-headline" id=".3D.3D.3D_Level_9_Heading.3D.3D.3D">=== Level 9 Heading===</span></h6>
8155 <h6><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=10" title="Edit section: ==== Level 10 Heading====">edit</a>]</span> <span class="mw-headline" id=".3D.3D.3D.3D_Level_10_Heading.3D.3D.3D.3D">==== Level 10 Heading====</span></h6>
8156
8157 !! end
8158
8159 !! test
8160 TOC regression (bug 9764)
8161 !! input
8162 == title 1 ==
8163 === title 1.1 ===
8164 ==== title 1.1.1 ====
8165 === title 1.2 ===
8166 == title 2 ==
8167 === title 2.1 ===
8168 !! result
8169 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8170 <ul>
8171 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
8172 <ul>
8173 <li class="toclevel-2 tocsection-2"><a href="#title_1.1"><span class="tocnumber">1.1</span> <span class="toctext">title 1.1</span></a>
8174 <ul>
8175 <li class="toclevel-3 tocsection-3"><a href="#title_1.1.1"><span class="tocnumber">1.1.1</span> <span class="toctext">title 1.1.1</span></a></li>
8176 </ul>
8177 </li>
8178 <li class="toclevel-2 tocsection-4"><a href="#title_1.2"><span class="tocnumber">1.2</span> <span class="toctext">title 1.2</span></a></li>
8179 </ul>
8180 </li>
8181 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
8182 <ul>
8183 <li class="toclevel-2 tocsection-6"><a href="#title_2.1"><span class="tocnumber">2.1</span> <span class="toctext">title 2.1</span></a></li>
8184 </ul>
8185 </li>
8186 </ul>
8187 </td></tr></table>
8188 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: title 1">edit</a>]</span> <span class="mw-headline" id="title_1">title 1</span></h2>
8189 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: title 1.1">edit</a>]</span> <span class="mw-headline" id="title_1.1">title 1.1</span></h3>
8190 <h4><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: title 1.1.1">edit</a>]</span> <span class="mw-headline" id="title_1.1.1">title 1.1.1</span></h4>
8191 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: title 1.2">edit</a>]</span> <span class="mw-headline" id="title_1.2">title 1.2</span></h3>
8192 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: title 2">edit</a>]</span> <span class="mw-headline" id="title_2">title 2</span></h2>
8193 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: title 2.1">edit</a>]</span> <span class="mw-headline" id="title_2.1">title 2.1</span></h3>
8194
8195 !! end
8196
8197 !! test
8198 TOC with wgMaxTocLevel=3 (bug 6204)
8199 !! options
8200 wgMaxTocLevel=3
8201 !! input
8202 == title 1 ==
8203 === title 1.1 ===
8204 ==== title 1.1.1 ====
8205 === title 1.2 ===
8206 == title 2 ==
8207 === title 2.1 ===
8208 !! result
8209 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8210 <ul>
8211 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
8212 <ul>
8213 <li class="toclevel-2 tocsection-2"><a href="#title_1.1"><span class="tocnumber">1.1</span> <span class="toctext">title 1.1</span></a></li>
8214 <li class="toclevel-2 tocsection-4"><a href="#title_1.2"><span class="tocnumber">1.2</span> <span class="toctext">title 1.2</span></a></li>
8215 </ul>
8216 </li>
8217 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
8218 <ul>
8219 <li class="toclevel-2 tocsection-6"><a href="#title_2.1"><span class="tocnumber">2.1</span> <span class="toctext">title 2.1</span></a></li>
8220 </ul>
8221 </li>
8222 </ul>
8223 </td></tr></table>
8224 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: title 1">edit</a>]</span> <span class="mw-headline" id="title_1">title 1</span></h2>
8225 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: title 1.1">edit</a>]</span> <span class="mw-headline" id="title_1.1">title 1.1</span></h3>
8226 <h4><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: title 1.1.1">edit</a>]</span> <span class="mw-headline" id="title_1.1.1">title 1.1.1</span></h4>
8227 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: title 1.2">edit</a>]</span> <span class="mw-headline" id="title_1.2">title 1.2</span></h3>
8228 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: title 2">edit</a>]</span> <span class="mw-headline" id="title_2">title 2</span></h2>
8229 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: title 2.1">edit</a>]</span> <span class="mw-headline" id="title_2.1">title 2.1</span></h3>
8230
8231 !! end
8232
8233 !! test
8234 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
8235 !! options
8236 wgMaxTocLevel=3
8237 !! input
8238 ==Section 1==
8239 ===Section 1.1===
8240 ====Section 1.1.1====
8241 ====Section 1.1.1.1====
8242 ==Section 2==
8243 !! result
8244 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8245 <ul>
8246 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
8247 <ul>
8248 <li class="toclevel-2 tocsection-2"><a href="#Section_1.1"><span class="tocnumber">1.1</span> <span class="toctext">Section 1.1</span></a></li>
8249 </ul>
8250 </li>
8251 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
8252 </ul>
8253 </td></tr></table>
8254 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 1">edit</a>]</span> <span class="mw-headline" id="Section_1">Section 1</span></h2>
8255 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Section 1.1">edit</a>]</span> <span class="mw-headline" id="Section_1.1">Section 1.1</span></h3>
8256 <h4><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Section 1.1.1">edit</a>]</span> <span class="mw-headline" id="Section_1.1.1">Section 1.1.1</span></h4>
8257 <h4><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Section 1.1.1.1">edit</a>]</span> <span class="mw-headline" id="Section_1.1.1.1">Section 1.1.1.1</span></h4>
8258 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Section 2">edit</a>]</span> <span class="mw-headline" id="Section_2">Section 2</span></h2>
8259
8260 !! end
8261
8262
8263 !! test
8264 Resolving duplicate section names
8265 !! input
8266 == Foo bar ==
8267 == Foo bar ==
8268 !! result
8269 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Foo bar">edit</a>]</span> <span class="mw-headline" id="Foo_bar">Foo bar</span></h2>
8270 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Foo bar">edit</a>]</span> <span class="mw-headline" id="Foo_bar_2">Foo bar</span></h2>
8271
8272 !! end
8273
8274 !! test
8275 Resolving duplicate section names with differing case (bug 10721)
8276 !! input
8277 == Foo bar ==
8278 == Foo Bar ==
8279 !! result
8280 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Foo bar">edit</a>]</span> <span class="mw-headline" id="Foo_bar">Foo bar</span></h2>
8281 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Foo Bar">edit</a>]</span> <span class="mw-headline" id="Foo_Bar_2">Foo Bar</span></h2>
8282
8283 !! end
8284
8285 !! article
8286 Template:sections
8287 !! text
8288 ===Section 1===
8289 ==Section 2==
8290 !! endarticle
8291
8292 !! test
8293 Template with sections, __NOTOC__
8294 !! input
8295 __NOTOC__
8296 ==Section 0==
8297 {{sections}}
8298 ==Section 4==
8299 !! result
8300 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 0">edit</a>]</span> <span class="mw-headline" id="Section_0">Section 0</span></h2>
8301 <h3><span class="editsection">[<a href="/index.php?title=Template:Sections&amp;action=edit&amp;section=T-1" title="Template:Sections">edit</a>]</span> <span class="mw-headline" id="Section_1">Section 1</span></h3>
8302 <h2><span class="editsection">[<a href="/index.php?title=Template:Sections&amp;action=edit&amp;section=T-2" title="Template:Sections">edit</a>]</span> <span class="mw-headline" id="Section_2">Section 2</span></h2>
8303 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Section 4">edit</a>]</span> <span class="mw-headline" id="Section_4">Section 4</span></h2>
8304
8305 !! end
8306
8307 !! test
8308 __NOEDITSECTION__ keyword
8309 !! input
8310 __NOEDITSECTION__
8311 ==Section 1==
8312 ==Section 2==
8313 !! result
8314 <h2> <span class="mw-headline" id="Section_1">Section 1</span></h2>
8315 <h2> <span class="mw-headline" id="Section_2">Section 2</span></h2>
8316
8317 !! end
8318
8319 !! test
8320 Link inside a section heading
8321 !! input
8322 ==Section with a [[Main Page|link]] in it==
8323 !! result
8324 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section with a link in it">edit</a>]</span> <span class="mw-headline" id="Section_with_a_link_in_it">Section with a <a href="/wiki/Main_Page" title="Main Page">link</a> in it</span></h2>
8325
8326 !! end
8327
8328 !! test
8329 TOC regression (bug 12077)
8330 !! input
8331 __TOC__
8332 == title 1 ==
8333 === title 1.1 ===
8334 == title 2 ==
8335 !! result
8336 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8337 <ul>
8338 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
8339 <ul>
8340 <li class="toclevel-2 tocsection-2"><a href="#title_1.1"><span class="tocnumber">1.1</span> <span class="toctext">title 1.1</span></a></li>
8341 </ul>
8342 </li>
8343 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
8344 </ul>
8345 </td></tr></table>
8346 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: title 1">edit</a>]</span> <span class="mw-headline" id="title_1">title 1</span></h2>
8347 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: title 1.1">edit</a>]</span> <span class="mw-headline" id="title_1.1">title 1.1</span></h3>
8348 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: title 2">edit</a>]</span> <span class="mw-headline" id="title_2">title 2</span></h2>
8349
8350 !! end
8351
8352 !! test
8353 BUG 1219 URL next to image (good)
8354 !! input
8355 http://example.com [[Image:foobar.jpg]]
8356 !! result
8357 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> <a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
8358 </p>
8359 !!end
8360
8361 !! test
8362 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
8363 !! input
8364 ===
8365 The line above must have a trailing space!
8366 === <!--
8367 --> <!-- -->
8368 But just in case it doesn't...
8369 !! result
8370 <h1><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: =">edit</a>]</span> <span class="mw-headline" id=".3D">=</span></h1>
8371 <p>The line above must have a trailing space!
8372 </p>
8373 <h1><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: =">edit</a>]</span> <span class="mw-headline" id=".3D_2">=</span></h1>
8374 <p>But just in case it doesn't...
8375 </p>
8376 !! end
8377
8378 !! test
8379 Header with special characters (bug 25462)
8380 !! input
8381 The tooltips shall not show entities to the user (ie. be double escaped)
8382
8383 == text > text ==
8384 section 1
8385
8386 == text < text ==
8387 section 2
8388
8389 == text & text ==
8390 section 3
8391
8392 == text ' text ==
8393 section 4
8394
8395 == text " text ==
8396 section 5
8397 !! result
8398 <p>The tooltips shall not show entities to the user (ie. be double escaped)
8399 </p>
8400 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8401 <ul>
8402 <li class="toclevel-1 tocsection-1"><a href="#text_.3E_text"><span class="tocnumber">1</span> <span class="toctext">text &gt; text</span></a></li>
8403 <li class="toclevel-1 tocsection-2"><a href="#text_.3C_text"><span class="tocnumber">2</span> <span class="toctext">text &lt; text</span></a></li>
8404 <li class="toclevel-1 tocsection-3"><a href="#text_.26_text"><span class="tocnumber">3</span> <span class="toctext">text &amp; text</span></a></li>
8405 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
8406 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
8407 </ul>
8408 </td></tr></table>
8409 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: text > text">edit</a>]</span> <span class="mw-headline" id="text_.3E_text">text &gt; text</span></h2>
8410 <p>section 1
8411 </p>
8412 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: text &lt; text">edit</a>]</span> <span class="mw-headline" id="text_.3C_text">text &lt; text</span></h2>
8413 <p>section 2
8414 </p>
8415 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: text &amp; text">edit</a>]</span> <span class="mw-headline" id="text_.26_text">text &amp; text</span></h2>
8416 <p>section 3
8417 </p>
8418 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: text ' text">edit</a>]</span> <span class="mw-headline" id="text_.27_text">text ' text</span></h2>
8419 <p>section 4
8420 </p>
8421 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: text &quot; text">edit</a>]</span> <span class="mw-headline" id="text_.22_text">text " text</span></h2>
8422 <p>section 5
8423 </p>
8424 !! end
8425
8426 !! test
8427 Headers with excess '=' characters
8428 (Are similar tests necessary beyond the 1st level?)
8429 !! input
8430 =foo==
8431 ==foo=
8432 =''italic'' heading==
8433 ==''italic'' heading=
8434 !! result
8435 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8436 <ul>
8437 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
8438 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
8439 <li class="toclevel-1 tocsection-3"><a href="#italic_heading.3D"><span class="tocnumber">3</span> <span class="toctext"><i>italic</i> heading=</span></a></li>
8440 <li class="toclevel-1 tocsection-4"><a href="#.3Ditalic_heading"><span class="tocnumber">4</span> <span class="toctext">=<i>italic</i> heading</span></a></li>
8441 </ul>
8442 </td></tr></table>
8443 <h1><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: foo=">edit</a>]</span> <span class="mw-headline" id="foo.3D">foo=</span></h1>
8444 <h1><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: =foo">edit</a>]</span> <span class="mw-headline" id=".3Dfoo">=foo</span></h1>
8445 <h1><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: italic heading=">edit</a>]</span> <span class="mw-headline" id="italic_heading.3D"><i>italic</i> heading=</span></h1>
8446 <h1><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: =italic heading">edit</a>]</span> <span class="mw-headline" id=".3Ditalic_heading">=<i>italic</i> heading</span></h1>
8447
8448 !! end
8449
8450 !! test
8451 HTML headers vs TOC (bug 23393)
8452 (__NOEDITSECTION__ for clearer output, doesn't matter here)
8453 !! input
8454 <h1>Header 1</h1>
8455 == Header 1.1 ==
8456 == Header 1.2 ==
8457
8458 <h1>Header 2
8459 </h1>
8460 == Header 2.1 ==
8461 == Header 2.2 ==
8462 __NOEDITSECTION__
8463 !! result
8464 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8465 <ul>
8466 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
8467 <ul>
8468 <li class="toclevel-2 tocsection-1"><a href="#Header_1.1"><span class="tocnumber">1.1</span> <span class="toctext">Header 1.1</span></a></li>
8469 <li class="toclevel-2 tocsection-2"><a href="#Header_1.2"><span class="tocnumber">1.2</span> <span class="toctext">Header 1.2</span></a></li>
8470 </ul>
8471 </li>
8472 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
8473 <ul>
8474 <li class="toclevel-2 tocsection-3"><a href="#Header_2.1"><span class="tocnumber">2.1</span> <span class="toctext">Header 2.1</span></a></li>
8475 <li class="toclevel-2 tocsection-4"><a href="#Header_2.2"><span class="tocnumber">2.2</span> <span class="toctext">Header 2.2</span></a></li>
8476 </ul>
8477 </li>
8478 </ul>
8479 </td></tr></table>
8480 <h1> <span class="mw-headline" id="Header_1">Header 1</span></h1>
8481 <h2> <span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
8482 <h2> <span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
8483 <h1> <span class="mw-headline" id="Header_2">Header 2</span></h1>
8484 <h2> <span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
8485 <h2> <span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
8486
8487 !! end
8488
8489 !! test
8490 BUG 1219 URL next to image (broken)
8491 !! input
8492 http://example.com[[Image:foobar.jpg]]
8493 !! result
8494 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
8495 </p>
8496 !!end
8497
8498 !! test
8499 Bug 1186 news: in the middle of text
8500 !! input
8501 http://en.wikinews.org/wiki/Wikinews:Workplace
8502 !! result
8503 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
8504 </p>
8505 !!end
8506
8507
8508 !! test
8509 Namespaced link must have a title
8510 !! input
8511 [[Project:]]
8512 !! result
8513 <p>[[Project:]]
8514 </p>
8515 !!end
8516
8517 !! test
8518 Namespaced link must have a title (bad fragment version)
8519 !! input
8520 [[Project:#fragment]]
8521 !! result
8522 <p>[[Project:#fragment]]
8523 </p>
8524 !!end
8525
8526
8527 ###
8528 ### HTML tags and HTML attributes
8529 ###
8530
8531 !! test
8532 div with no attributes
8533 !! input
8534 <div>HTML rocks</div>
8535 !! result
8536 <div>HTML rocks</div>
8537
8538 !! end
8539
8540 !! test
8541 div with double-quoted attribute
8542 !! input
8543 <div id="rock">HTML rocks</div>
8544 !! result
8545 <div id="rock">HTML rocks</div>
8546
8547 !! end
8548
8549 !! test
8550 div with single-quoted attribute
8551 !! input
8552 <div id='rock'>HTML rocks</div>
8553 !! result
8554 <div id="rock">HTML rocks</div>
8555
8556 !! end
8557
8558 !! test
8559 div with unquoted attribute
8560 !! input
8561 <div id=rock>HTML rocks</div>
8562 !! result
8563 <div id="rock">HTML rocks</div>
8564
8565 !! end
8566
8567 !! test
8568 div with illegal double attributes
8569 !! input
8570 <div id="a" id="b">HTML rocks</div>
8571 !! result
8572 <div id="b">HTML rocks</div>
8573
8574 !!end
8575
8576 # FIXME: produce empty string instead of "class" in the PHP parser, following
8577 # the HTML5 spec.
8578 !! test
8579 div with empty attribute value, space before equals
8580 !! options
8581 disabled
8582 !! input
8583 <div class =>HTML rocks</div>
8584 !! result
8585 <div class="">HTML rocks</div>
8586
8587 !! end
8588
8589 # The PHP parser escapes the opening brace to &#123; for some reason, so
8590 # disabled this test for it.
8591 !! test
8592 div with braces in attribute value
8593 !! options
8594 disabled
8595 !! input
8596 <div title="{}">Foo</div>
8597 !! result
8598 <div title="{}">Foo</div>
8599 !! end
8600
8601 # This it very inconsistent in the PHP parser: it returns
8602 # class="class" if there is a space between the name and the equal sign (see
8603 # 'div with empty attribute value, space before equals'), but strips the
8604 # attribute completely if the space is missing. We hope that not much content
8605 # depends on this, so are implementing the behavior below in Parsoid for
8606 # consistencies' sake. Disabled for the PHP parser.
8607 # FIXME: fix this behavior in the PHP parser?
8608 !! test
8609 div with empty attribute value, no space before equals
8610 !! options
8611 disabled
8612 !! input
8613 <div class=>HTML rocks</div>
8614 !! result
8615 <div class="">HTML rocks</div>
8616
8617 !! end
8618
8619 !! test
8620 HTML multiple attributes correction
8621 !! input
8622 <p class="error" class="awesome">Awesome!</p>
8623 !! result
8624 <p class="awesome">Awesome!</p>
8625
8626 !!end
8627
8628 !! test
8629 Table multiple attributes correction
8630 !! input
8631 {|
8632 !+ class="error" class="awesome"| status
8633 |}
8634 !! result
8635 <table>
8636 <tr>
8637 <th class="awesome"> status
8638 </th></tr></table>
8639
8640 !!end
8641
8642 !! test
8643 DIV IN UPPERCASE
8644 !! input
8645 <DIV ID="x">HTML ROCKS</DIV>
8646 !! result
8647 <div id="x">HTML ROCKS</div>
8648
8649 !!end
8650
8651 !! test
8652 Non-ASCII pseudo-tags are rendered as text
8653 !! input
8654 <khyô>
8655 !! result
8656 <p>&lt;khyô&gt;
8657 </p>
8658 !! end
8659
8660 !! test
8661 Pseudo-tag with URL 'name' renders as url link
8662 !! input
8663 <http://example.com/>
8664 !! result
8665 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
8666 </p>
8667 !! end
8668
8669 !! test
8670 text with amp in the middle of nowhere
8671 !! input
8672 Remember AT&T?
8673 !!result
8674 <p>Remember AT&amp;T?
8675 </p>
8676 !! end
8677
8678 !! test
8679 text with character entity: eacute
8680 !! input
8681 I always thought &eacute; was a cute letter.
8682 !! result
8683 <p>I always thought &#233; was a cute letter.
8684 </p>
8685 !! end
8686
8687 !! test
8688 text with entity-escaped character entity-like string: eacute
8689 !! input
8690 I always thought &amp;eacute; was a cute letter.
8691 !! result
8692 <p>I always thought &amp;eacute; was a cute letter.
8693 </p>
8694 !! end
8695
8696 !! test
8697 text with undefined character entity: xacute
8698 !! input
8699 I always thought &xacute; was a cute letter.
8700 !! result
8701 <p>I always thought &amp;xacute; was a cute letter.
8702 </p>
8703 !! end
8704
8705
8706 ###
8707 ### Media links
8708 ###
8709
8710 !! test
8711 Media link
8712 !! input
8713 [[Media:Foobar.jpg]]
8714 !! result
8715 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
8716 </p>
8717 !! end
8718
8719 !! test
8720 Media link with text
8721 !! input
8722 [[Media:Foobar.jpg|A neat file to look at]]
8723 !! result
8724 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
8725 </p>
8726 !! end
8727
8728 # FIXME: this is still bad HTML tag nesting
8729 !! test
8730 Media link with nasty text
8731 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
8732 !! input
8733 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
8734 !! result
8735 <a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link&lt;div style="display:none"&gt;" onmouseover="alert(document.cookie)" onfoo="&lt;/div&gt;</a>
8736
8737 !! end
8738
8739 !! test
8740 Media link to nonexistent file (bug 1702)
8741 !! input
8742 [[Media:No such.jpg]]
8743 !! result
8744 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
8745 </p>
8746 !! end
8747
8748 !! test
8749 Image link to nonexistent file (bug 1850 - good)
8750 !! input
8751 [[Image:No such.jpg]]
8752 !! result
8753 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="File:No such.jpg">File:No such.jpg</a>
8754 </p>
8755 !! end
8756
8757 !! test
8758 :Image link to nonexistent file (bug 1850 - bad)
8759 !! input
8760 [[:Image:No such.jpg]]
8761 !! result
8762 <p><a href="/index.php?title=File:No_such.jpg&amp;action=edit&amp;redlink=1" class="new" title="File:No such.jpg (page does not exist)">Image:No such.jpg</a>
8763 </p>
8764 !! end
8765
8766
8767
8768 !! test
8769 Character reference normalization in link text (bug 1938)
8770 !! input
8771 [[Main Page|this&that]]
8772 !! result
8773 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
8774 </p>
8775 !!end
8776
8777 !! article
8778 אַ
8779 !! text
8780 Test for unicode normalization
8781
8782 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
8783 !! endarticle
8784
8785 !! test
8786 (bug 19451) Links should refer to the normalized form.
8787 !! input
8788 [[&#xFB2E;]]
8789 [[&#x5d0;&#x5b7;]]
8790 [[&#x5d0;ַ]]
8791 [[א&#x5b7;]]
8792 [[אַ]]
8793 !! result
8794 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
8795 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
8796 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
8797 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
8798 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
8799 </p>
8800 !! end
8801
8802 !! test
8803 Empty attribute crash test (bug 2067)
8804 !! input
8805 <font color="">foo</font>
8806 !! result
8807 <p><font color="">foo</font>
8808 </p>
8809 !! end
8810
8811 !! test
8812 Empty attribute crash test single-quotes (bug 2067)
8813 !! input
8814 <font color=''>foo</font>
8815 !! result
8816 <p><font color="">foo</font>
8817 </p>
8818 !! end
8819
8820 !! test
8821 Attribute test: equals, then nothing
8822 !! input
8823 <font color=>foo</font>
8824 !! result
8825 <p><font>foo</font>
8826 </p>
8827 !! end
8828
8829 !! test
8830 Attribute test: unquoted value
8831 !! input
8832 <font color=x>foo</font>
8833 !! result
8834 <p><font color="x">foo</font>
8835 </p>
8836 !! end
8837
8838 !! test
8839 Attribute test: unquoted but illegal value (hash)
8840 !! input
8841 <font color=#x>foo</font>
8842 !! result
8843 <p><font color="#x">foo</font>
8844 </p>
8845 !! end
8846
8847 !! test
8848 Attribute test: no value
8849 !! input
8850 <font color>foo</font>
8851 !! result
8852 <p><font color="color">foo</font>
8853 </p>
8854 !! end
8855
8856 !! test
8857 Bug 2095: link with three closing brackets
8858 !! input
8859 [[Main Page]]]
8860 !! result
8861 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
8862 </p>
8863 !! end
8864
8865 !! test
8866 Bug 2095: link with pipe and three closing brackets
8867 !! input
8868 [[Main Page|link]]]
8869 !! result
8870 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
8871 </p>
8872 !! end
8873
8874 !! test
8875 Bug 2095: link with pipe and three closing brackets, version 2
8876 !! input
8877 [[Main Page|[http://example.com/]]]
8878 !! result
8879 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
8880 </p>
8881 !! end
8882
8883
8884 ###
8885 ### Safety
8886 ###
8887
8888 !! article
8889 Template:Dangerous attribute
8890 !! text
8891 " onmouseover="alert(document.cookie)
8892 !! endarticle
8893
8894 !! article
8895 Template:Dangerous style attribute
8896 !! text
8897 border-size: expression(alert(document.cookie))
8898 !! endarticle
8899
8900 !! article
8901 Template:Div style
8902 !! text
8903 <div style="float: right; {{{1}}}">Magic div</div>
8904 !! endarticle
8905
8906 !! test
8907 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
8908 !! input
8909 <div title="{{test}}"></div>
8910 !! result
8911 <div title="This is a test template"></div>
8912
8913 !! end
8914
8915 !! test
8916 Bug 2304: HTML attribute safety (dangerous template; 2309)
8917 !! input
8918 <div title="{{dangerous attribute}}"></div>
8919 !! result
8920 <div title=""></div>
8921
8922 !! end
8923
8924 !! test
8925 Bug 2304: HTML attribute safety (dangerous style template; 2309)
8926 !! input
8927 <div style="{{dangerous style attribute}}"></div>
8928 !! result
8929 <div style="/* insecure input */"></div>
8930
8931 !! end
8932
8933 !! test
8934 Bug 2304: HTML attribute safety (safe parameter; 2309)
8935 !! input
8936 {{div style|width: 200px}}
8937 !! result
8938 <div style="float: right; width: 200px">Magic div</div>
8939
8940 !! end
8941
8942 !! test
8943 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
8944 !! input
8945 {{div style|width: expression(alert(document.cookie))}}
8946 !! result
8947 <div style="/* insecure input */">Magic div</div>
8948
8949 !! end
8950
8951 !! test
8952 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
8953 !! input
8954 {{div style|"><script>alert(document.cookie)</script>}}
8955 !! result
8956 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
8957
8958 !! end
8959
8960 !! test
8961 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
8962 !! input
8963 {{div style|" ><script>alert(document.cookie)</script>}}
8964 !! result
8965 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
8966
8967 !! end
8968
8969 !! test
8970 Bug 2304: HTML attribute safety (link)
8971 !! input
8972 <div title="[[Main Page]]"></div>
8973 !! result
8974 <div title="&#91;&#91;Main Page]]"></div>
8975
8976 !! end
8977
8978 !! test
8979 Bug 2304: HTML attribute safety (italics)
8980 !! input
8981 <div title="''foobar''"></div>
8982 !! result
8983 <div title="&#39;&#39;foobar&#39;&#39;"></div>
8984
8985 !! end
8986
8987 !! test
8988 Bug 2304: HTML attribute safety (bold)
8989 !! input
8990 <div title="'''foobar'''"></div>
8991 !! result
8992 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
8993
8994 !! end
8995
8996
8997 !! test
8998 Bug 2304: HTML attribute safety (ISBN)
8999 !! input
9000 <div title="ISBN 1234567890"></div>
9001 !! result
9002 <div title="&#73;SBN 1234567890"></div>
9003
9004 !! end
9005
9006 !! test
9007 Bug 2304: HTML attribute safety (RFC)
9008 !! input
9009 <div title="RFC 1234"></div>
9010 !! result
9011 <div title="&#82;FC 1234"></div>
9012
9013 !! end
9014
9015 !! test
9016 Bug 2304: HTML attribute safety (PMID)
9017 !! input
9018 <div title="PMID 1234567890"></div>
9019 !! result
9020 <div title="&#80;MID 1234567890"></div>
9021
9022 !! end
9023
9024 !! test
9025 Bug 2304: HTML attribute safety (web link)
9026 !! input
9027 <div title="http://example.com/"></div>
9028 !! result
9029 <div title="http&#58;//example.com/"></div>
9030
9031 !! end
9032
9033 !! test
9034 Bug 2304: HTML attribute safety (named web link)
9035 !! input
9036 <div title="[http://example.com/ link]"></div>
9037 !! result
9038 <div title="&#91;http&#58;//example.com/ link]"></div>
9039
9040 !! end
9041
9042 !! test
9043 Bug 3244: HTML attribute safety (extension; safe)
9044 !! input
9045 <div style="<nowiki>background:blue</nowiki>"></div>
9046 !! result
9047 <div style="background:blue"></div>
9048
9049 !! end
9050
9051 !! test
9052 Bug 3244: HTML attribute safety (extension; unsafe)
9053 !! input
9054 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
9055 !! result
9056 <div style="/* insecure input */"></div>
9057
9058 !! end
9059
9060 # More MSIE fun discovered by Tom Gilder
9061
9062 !! test
9063 MSIE CSS safety test: spurious slash
9064 !! input
9065 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
9066 !! result
9067 <div style="/* insecure input */">evil</div>
9068
9069 !! end
9070
9071 !! test
9072 MSIE CSS safety test: hex code
9073 !! input
9074 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
9075 !! result
9076 <div style="/* insecure input */">evil</div>
9077
9078 !! end
9079
9080 !! test
9081 MSIE CSS safety test: comment in url
9082 !! input
9083 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
9084 !! result
9085 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
9086
9087 !! end
9088
9089 !! test
9090 MSIE CSS safety test: comment in expression
9091 !! input
9092 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
9093 !! result
9094 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
9095
9096 !! end
9097
9098
9099 !! test
9100 Table attribute legitimate extension
9101 !! input
9102 {|
9103 !+ style="<nowiki>color:blue</nowiki>"| status
9104 |}
9105 !! result
9106 <table>
9107 <tr>
9108 <th style="color:blue"> status
9109 </th></tr></table>
9110
9111 !!end
9112
9113 !! test
9114 Table attribute safety
9115 !! input
9116 {|
9117 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
9118 |}
9119 !! result
9120 <table>
9121 <tr>
9122 <th style="/* insecure input */"> status
9123 </th></tr></table>
9124
9125 !! end
9126
9127 !! test
9128 CSS line continuation 1
9129 !! input
9130 <div style="background-image: u\&#10;rl(test.jpg);"></div>
9131 !! result
9132 <div style="/* insecure input */"></div>
9133
9134 !! end
9135
9136 !! test
9137 CSS line continuation 2
9138 !! input
9139 <div style="background-image: u\&#13;rl(test.jpg); "></div>
9140 !! result
9141 <div style="/* insecure input */"></div>
9142
9143 !! end
9144
9145 !! article
9146 Template:Identity
9147 !! text
9148 {{{1}}}
9149 !! endarticle
9150
9151 !! test
9152 Expansion of multi-line templates in attribute values (bug 6255)
9153 !! input
9154 <div style="background: {{identity|#00FF00}}">-</div>
9155 !! result
9156 <div style="background: #00FF00">-</div>
9157
9158 !! end
9159
9160
9161 !! test
9162 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
9163 !! input
9164 <div style="background:
9165 #00FF00">-</div>
9166 !! result
9167 <div style="background: #00FF00">-</div>
9168
9169 !! end
9170
9171 !! test
9172 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
9173 !! input
9174 <div style="background: &#10;#00FF00">-</div>
9175 !! result
9176 <div style="background: &#10;#00FF00">-</div>
9177
9178 !! end
9179
9180 ###
9181 ### Parser hooks (see maintenance/parserTestsParserHook.php for the <tag> extension)
9182 ###
9183 !! test
9184 Parser hook: empty input
9185 !! input
9186 <tag></tag>
9187 !! result
9188 <pre>
9189 ''
9190 array (
9191 )
9192 </pre>
9193
9194 !! end
9195
9196 !! test
9197 Parser hook: empty input using terminated empty elements
9198 !! input
9199 <tag/>
9200 !! result
9201 <pre>
9202 NULL
9203 array (
9204 )
9205 </pre>
9206
9207 !! end
9208
9209 !! test
9210 Parser hook: empty input using terminated empty elements (space before)
9211 !! input
9212 <tag />
9213 !! result
9214 <pre>
9215 NULL
9216 array (
9217 )
9218 </pre>
9219
9220 !! end
9221
9222 !! test
9223 Parser hook: basic input
9224 !! input
9225 <tag>input</tag>
9226 !! result
9227 <pre>
9228 'input'
9229 array (
9230 )
9231 </pre>
9232
9233 !! end
9234
9235
9236 !! test
9237 Parser hook: case insensitive
9238 !! input
9239 <TAG>input</TAG>
9240 !! result
9241 <pre>
9242 'input'
9243 array (
9244 )
9245 </pre>
9246
9247 !! end
9248
9249
9250 !! test
9251 Parser hook: case insensitive, redux
9252 !! input
9253 <TaG>input</TAg>
9254 !! result
9255 <pre>
9256 'input'
9257 array (
9258 )
9259 </pre>
9260
9261 !! end
9262
9263 !! test
9264 Parser hook: nested tags
9265 !! options
9266 noxml
9267 !! input
9268 <tag><tag></tag></tag>
9269 !! result
9270 <pre>
9271 '<tag>'
9272 array (
9273 )
9274 </pre>&lt;/tag&gt;
9275
9276 !! end
9277
9278 !! test
9279 Parser hook: basic arguments
9280 !! input
9281 <tag width=200 height = "100" depth = '50' square></tag>
9282 !! result
9283 <pre>
9284 ''
9285 array (
9286 'width' => '200',
9287 'height' => '100',
9288 'depth' => '50',
9289 'square' => 'square',
9290 )
9291 </pre>
9292
9293 !! end
9294
9295 !! test
9296 Parser hook: argument containing a forward slash (bug 5344)
9297 !! input
9298 <tag filename='/tmp/bla'></tag>
9299 !! result
9300 <pre>
9301 ''
9302 array (
9303 'filename' => '/tmp/bla',
9304 )
9305 </pre>
9306
9307 !! end
9308
9309 !! test
9310 Parser hook: empty input using terminated empty elements (bug 2374)
9311 !! input
9312 <tag foo=bar/>text
9313 !! result
9314 <pre>
9315 NULL
9316 array (
9317 'foo' => 'bar',
9318 )
9319 </pre>text
9320
9321 !! end
9322
9323 # </tag> should be output literally since there is no matching tag that begins it
9324 !! test
9325 Parser hook: basic arguments using terminated empty elements (bug 2374)
9326 !! input
9327 <tag width=200 height = "100" depth = '50' square/>
9328 other stuff
9329 </tag>
9330 !! result
9331 <pre>
9332 NULL
9333 array (
9334 'width' => '200',
9335 'height' => '100',
9336 'depth' => '50',
9337 'square' => 'square',
9338 )
9339 </pre>
9340 <p>other stuff
9341 &lt;/tag&gt;
9342 </p>
9343 !! end
9344
9345 ###
9346 ### (see maintenance/parserTestsStaticParserHook.php for the <statictag> extension)
9347 ###
9348
9349 !! test
9350 Parser hook: static parser hook not inside a comment
9351 !! input
9352 <statictag>hello, world</statictag>
9353 <statictag action=flush/>
9354 !! result
9355 <p>hello, world
9356 </p>
9357 !! end
9358
9359
9360 !! test
9361 Parser hook: static parser hook inside a comment
9362 !! input
9363 <!-- <statictag>hello, world</statictag> -->
9364 <statictag action=flush/>
9365 !! result
9366 <p><br />
9367 </p>
9368 !! end
9369
9370 # Nested template calls; this case was broken by Parser.php rev 1.506,
9371 # since reverted.
9372
9373 !! article
9374 Template:One-parameter
9375 !! text
9376 (My parameter is: {{{1}}})
9377 !! endarticle
9378
9379 !! article
9380 Template:Map-one-parameter
9381 !! text
9382 {{{{{1}}}|{{{2}}}}}
9383 !! endarticle
9384
9385 !! test
9386 Nested template calls
9387 !! input
9388 {{Map-one-parameter|One-parameter|param}}
9389 !! result
9390 <p>(My parameter is: param)
9391 </p>
9392 !! end
9393
9394
9395 ###
9396 ### Sanitizer
9397 ###
9398 !! test
9399 Sanitizer: Closing of open tags
9400 !! input
9401 <s></s><table></table>
9402 !! result
9403 <s></s><table></table>
9404
9405 !! end
9406
9407 !! test
9408 Sanitizer: Closing of open but not closed tags
9409 !! input
9410 <s>foo
9411 !! result
9412 <p><s>foo</s>
9413 </p>
9414 !! end
9415
9416 !! test
9417 Sanitizer: Closing of closed but not open tags
9418 !! input
9419 </s>
9420 !! result
9421 <p>&lt;/s&gt;
9422 </p>
9423 !! end
9424
9425 !! test
9426 Sanitizer: Closing of closed but not open table tags
9427 !! input
9428 Table not started</td></tr></table>
9429 !! result
9430 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
9431 </p>
9432 !! end
9433
9434 !! test
9435 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
9436 !! input
9437 <span id="æ: v">byte</span>[[#æ: v|backlink]]
9438 !! result
9439 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
9440 </p>
9441 !! end
9442
9443 !! test
9444 Sanitizer: Validating the contents of the id attribute (bug 4515)
9445 !! options
9446 disabled
9447 !! input
9448 <br id=9 />
9449 !! result
9450 Something, but definitely not <br id="9" />...
9451 !! end
9452
9453 !! test
9454 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
9455 !! options
9456 disabled
9457 !! input
9458 <br id="foo" /><br id="foo" />
9459 !! result
9460 Something need to be done. foo-2 ?
9461 !! end
9462
9463 !! test
9464 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
9465 !! input
9466 <div itemscope>
9467 <meta itemprop="hello" content="world">
9468 <meta http-equiv="refresh" content="5">
9469 <meta itemprop="hello" http-equiv="refresh" content="5">
9470 <link itemprop="hello" href="{{SERVER}}">
9471 <link rel="stylesheet" href="{{SERVER}}">
9472 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
9473 </div>
9474 !! result
9475 <div itemscope="itemscope">
9476 <p> <meta itemprop="hello" content="world" />
9477 &lt;meta http-equiv="refresh" content="5"&gt;
9478 <meta itemprop="hello" content="5" />
9479 </p>
9480 <link itemprop="hello" href="http&#58;//example.org" />
9481 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
9482 <link itemprop="hello" href="http&#58;//example.org" />
9483 </div>
9484
9485 !! end
9486
9487 !! test
9488 Language converter: output gets cut off unexpectedly (bug 5757)
9489 !! options
9490 language=zh
9491 !! input
9492 this bit is safe: }-
9493
9494 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
9495
9496 then we get cut off here: }-
9497
9498 all additional text is vanished
9499 !! result
9500 <p>this bit is safe: }-
9501 </p><p>but if we add a conversion instance: xxx
9502 </p><p>then we get cut off here: }-
9503 </p><p>all additional text is vanished
9504 </p>
9505 !! end
9506
9507 !! test
9508 Self closed html pairs (bug 5487)
9509 !! options
9510 !! input
9511 <center><font id="bug" />Centered text</center>
9512 <div><font id="bug2" />In div text</div>
9513 !! result
9514 <center>&lt;font id="bug" /&gt;Centered text</center>
9515 <div>&lt;font id="bug2" /&gt;In div text</div>
9516
9517 !! end
9518
9519 #
9520 #
9521 #
9522
9523 !! test
9524 Punctuation: nbsp before exclamation
9525 !! input
9526 C'est grave !
9527 !! result
9528 <p>C'est grave&#160;!
9529 </p>
9530 !! end
9531
9532 !! test
9533 Punctuation: CSS !important (bug 11874)
9534 !! input
9535 <div style="width:50% !important">important</div>
9536 !! result
9537 <div style="width:50% !important">important</div>
9538
9539 !!end
9540
9541 !! test
9542 Punctuation: CSS ! important (bug 11874; with space after)
9543 !! input
9544 <div style="width:50% ! important">important</div>
9545 !! result
9546 <div style="width:50% ! important">important</div>
9547
9548 !!end
9549
9550
9551 !! test
9552 HTML bullet list, closed tags (bug 5497)
9553 !! input
9554 <ul>
9555 <li>One</li>
9556 <li>Two</li>
9557 </ul>
9558 !! result
9559 <ul>
9560 <li>One</li>
9561 <li>Two</li>
9562 </ul>
9563
9564 !! end
9565
9566 !! test
9567 HTML bullet list, unclosed tags (bug 5497)
9568 !! options
9569 disabled
9570 !! input
9571 <ul>
9572 <li>One
9573 <li>Two
9574 </ul>
9575 !! result
9576 <ul>
9577 <li>One
9578 </li><li>Two
9579 </li></ul>
9580
9581 !! end
9582
9583 !! test
9584 HTML ordered list, closed tags (bug 5497)
9585 !! input
9586 <ol>
9587 <li>One</li>
9588 <li>Two</li>
9589 </ol>
9590 !! result
9591 <ol>
9592 <li>One</li>
9593 <li>Two</li>
9594 </ol>
9595
9596 !! end
9597
9598 !! test
9599 HTML ordered list, unclosed tags (bug 5497)
9600 !! options
9601 disabled
9602 !! input
9603 <ol>
9604 <li>One
9605 <li>Two
9606 </ol>
9607 !! result
9608 <ol>
9609 <li>One
9610 </li><li>Two
9611 </li></ol>
9612
9613 !! end
9614
9615 !! test
9616 HTML nested bullet list, closed tags (bug 5497)
9617 !! input
9618 <ul>
9619 <li>One</li>
9620 <li>Two:
9621 <ul>
9622 <li>Sub-one</li>
9623 <li>Sub-two</li>
9624 </ul>
9625 </li>
9626 </ul>
9627 !! result
9628 <ul>
9629 <li>One</li>
9630 <li>Two:
9631 <ul>
9632 <li>Sub-one</li>
9633 <li>Sub-two</li>
9634 </ul>
9635 </li>
9636 </ul>
9637
9638 !! end
9639
9640 !! test
9641 HTML nested bullet list, open tags (bug 5497)
9642 !! options
9643 disabled
9644 !! input
9645 <ul>
9646 <li>One
9647 <li>Two:
9648 <ul>
9649 <li>Sub-one
9650 <li>Sub-two
9651 </ul>
9652 </ul>
9653 !! result
9654 <ul>
9655 <li>One
9656 </li><li>Two:
9657 <ul>
9658 <li>Sub-one
9659 </li><li>Sub-two
9660 </li></ul>
9661 </li></ul>
9662
9663 !! end
9664
9665 !! test
9666 HTML nested ordered list, closed tags (bug 5497)
9667 !! input
9668 <ol>
9669 <li>One</li>
9670 <li>Two:
9671 <ol>
9672 <li>Sub-one</li>
9673 <li>Sub-two</li>
9674 </ol>
9675 </li>
9676 </ol>
9677 !! result
9678 <ol>
9679 <li>One</li>
9680 <li>Two:
9681 <ol>
9682 <li>Sub-one</li>
9683 <li>Sub-two</li>
9684 </ol>
9685 </li>
9686 </ol>
9687
9688 !! end
9689
9690 !! test
9691 HTML nested ordered list, open tags (bug 5497)
9692 !! options
9693 disabled
9694 !! input
9695 <ol>
9696 <li>One
9697 <li>Two:
9698 <ol>
9699 <li>Sub-one
9700 <li>Sub-two
9701 </ol>
9702 </ol>
9703 !! result
9704 <ol>
9705 <li>One
9706 </li><li>Two:
9707 <ol>
9708 <li>Sub-one
9709 </li><li>Sub-two
9710 </li></ol>
9711 </li></ol>
9712
9713 !! end
9714
9715 !! test
9716 HTML ordered list item with parameters oddity
9717 !! input
9718 <ol><li id="fragment">One</li></ol>
9719 !! result
9720 <ol><li id="fragment">One</li></ol>
9721
9722 !! end
9723
9724 !!test
9725 bug 5918: autonumbering
9726 !! input
9727 [http://first/] [http://second] [ftp://ftp]
9728
9729 ftp://inlineftp
9730
9731 [mailto:enclosed@mail.tld With target]
9732
9733 [mailto:enclosed@mail.tld]
9734
9735 mailto:inline@mail.tld
9736 !! result
9737 <p><a rel="nofollow" class="external autonumber" href="http://first/">[1]</a> <a rel="nofollow" class="external autonumber" href="http://second">[2]</a> <a rel="nofollow" class="external autonumber" href="ftp://ftp">[3]</a>
9738 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
9739 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
9740 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
9741 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
9742 </p>
9743 !! end
9744
9745
9746 #
9747 # Security and HTML correctness
9748 # From Nick Jenkins' fuzz testing
9749 #
9750
9751 !! test
9752 Fuzz testing: Parser13
9753 !! input
9754 {|
9755 | http://a|
9756 !! result
9757 <table>
9758 <tr>
9759 <td>
9760 </td>
9761 </tr>
9762 </table>
9763
9764 !! end
9765
9766 !! test
9767 Fuzz testing: Parser14
9768 !! input
9769 == onmouseover= ==
9770 http://__TOC__
9771 !! result
9772 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: onmouseover=">edit</a>]</span> <span class="mw-headline" id="onmouseover.3D">onmouseover=</span></h2>
9773 http://<table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
9774 <ul>
9775 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
9776 </ul>
9777 </td></tr></table>
9778
9779 !! end
9780
9781 !! test
9782 Fuzz testing: Parser14-table
9783 !! input
9784 ==a==
9785 {| STYLE=__TOC__
9786 !! result
9787 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: a">edit</a>]</span> <span class="mw-headline" id="a">a</span></h2>
9788 <table style="&#95;_TOC&#95;_">
9789 <tr><td></td></tr>
9790 </table>
9791
9792 !! end
9793
9794 # Known to produce bogus xml (extra </td>)
9795 !! test
9796 Fuzz testing: Parser16
9797 !! options
9798 noxml
9799 !! input
9800 {|
9801 !https://||||||
9802 !! result
9803 <table>
9804 <tr>
9805 <th>https://</th>
9806 <th></th>
9807 <th></th>
9808 <th>
9809 </td>
9810 </tr>
9811 </table>
9812
9813 !! end
9814
9815 !! test
9816 Fuzz testing: Parser21
9817 !! input
9818 {|
9819 ! irc://{{ftp://a" onmouseover="alert('hello world');"
9820 |
9821 !! result
9822 <table>
9823 <tr>
9824 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
9825 </th>
9826 <td>
9827 </td>
9828 </tr>
9829 </table>
9830
9831 !! end
9832
9833 !! test
9834 Fuzz testing: Parser22
9835 !! input
9836 http://===r:::https://b
9837
9838 {|
9839 !!result
9840 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
9841 </p>
9842 <table>
9843 <tr><td></td></tr>
9844 </table>
9845
9846 !! end
9847
9848 # Known to produce bad XML for now
9849 !! test
9850 Fuzz testing: Parser24
9851 !! options
9852 noxml
9853 !! input
9854 {|
9855 {{{|
9856 <u CLASS=
9857 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
9858 <br style="onmouseover='alert(document.cookie);' " />
9859
9860 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
9861 |
9862 !! result
9863 <table>
9864 {{{|
9865 <u class="&#124;">}}}} &gt;
9866 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
9867
9868 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
9869 <tr>
9870 <td></u>
9871 </td>
9872 </tr>
9873 </table>
9874
9875 !! end
9876
9877 # Note: the current result listed for this is not what the original one was,
9878 # but the original bug was JavaScript injection, which is fixed in any case.
9879 # It's not clear that the original result listed was any more correct than the
9880 # current one. Original result:
9881 # <p>{{{|
9882 # </p>
9883 # <li class="&#124;&#124;">
9884 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
9885 !!test
9886 Fuzz testing: Parser25 (bug 6055)
9887 !! input
9888 {{{
9889 |
9890 <LI CLASS=||
9891 >
9892 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
9893 !! result
9894 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
9895 </p>
9896 !! end
9897
9898 !!test
9899 Fuzz testing: URL adjacent extension (with space, clean)
9900 !! options
9901 !! input
9902 http://example.com <nowiki>junk</nowiki>
9903 !! result
9904 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
9905 </p>
9906 !!end
9907
9908 !!test
9909 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
9910 !! options
9911 !! input
9912 http://example.com<nowiki>junk</nowiki>
9913 !! result
9914 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
9915 </p>
9916 !!end
9917
9918 !!test
9919 Fuzz testing: URL adjacent extension (no space, dirty; pre)
9920 !! options
9921 !! input
9922 http://example.com<pre>junk</pre>
9923 !! result
9924 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
9925
9926 !!end
9927
9928 !!test
9929 Fuzz testing: image with bogus manual thumbnail
9930 !!input
9931 [[Image:foobar.jpg|thumbnail= ]]
9932 !!result
9933 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
9934
9935 !!end
9936
9937 !! test
9938 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
9939 !! input
9940 <pre dir="&#10;"></pre>
9941 !! result
9942 <pre dir="&#10;"></pre>
9943
9944 !! end
9945
9946 !! test
9947 Parsing optional HTML elements (Bug 6171)
9948 !! options
9949 !! input
9950 <table>
9951 <tr>
9952 <td> Some tabular data</td>
9953 <td> More tabular data ...
9954 <td> And yet som tabular data</td>
9955 </tr>
9956 </table>
9957 !! result
9958 <table>
9959 <tr>
9960 <td> Some tabular data</td>
9961 <td> More tabular data ...
9962 </td><td> And yet som tabular data</td>
9963 </tr>
9964 </table>
9965
9966 !! end
9967
9968 !! test
9969 Correct handling of <td>, <tr> (Bug 6171)
9970 !! options
9971 !! input
9972 <table>
9973 <tr>
9974 <td> Some tabular data</td>
9975 <td> More tabular data ...</td>
9976 <td> And yet som tabular data</td>
9977 </tr>
9978 </table>
9979 !! result
9980 <table>
9981 <tr>
9982 <td> Some tabular data</td>
9983 <td> More tabular data ...</td>
9984 <td> And yet som tabular data</td>
9985 </tr>
9986 </table>
9987
9988 !! end
9989
9990
9991 !! test
9992 Parsing crashing regression (fr:JavaScript)
9993 !! input
9994 </body></x>
9995 !! result
9996 <p>&lt;/body&gt;&lt;/x&gt;
9997 </p>
9998 !! end
9999
10000 !! test
10001 Inline wiki vs wiki block nesting
10002 !! input
10003 '''Bold paragraph
10004
10005 New wiki paragraph
10006 !! result
10007 <p><b>Bold paragraph</b>
10008 </p><p>New wiki paragraph
10009 </p>
10010 !! end
10011
10012 !! test
10013 Inline HTML vs wiki block nesting
10014 !! options
10015 disabled
10016 !! input
10017 <b>Bold paragraph
10018
10019 New wiki paragraph
10020 !! result
10021 <p><b>Bold paragraph</b>
10022 </p><p>New wiki paragraph
10023 </p>
10024 !! end
10025
10026 # Original result was this:
10027 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
10028 # </p>
10029 # While that might be marginally more intuitive, maybe, the six-apostrophe
10030 # construct is clearly pathological and the result stated here (which is what
10031 # the parser actually does) is about as reasonable as anything.
10032 !!test
10033 Mixing markup for italics and bold
10034 !! options
10035 !! input
10036 '''bold''''''bold''bolditalics'''''
10037 !! result
10038 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
10039 </p>
10040 !! end
10041
10042
10043 !! article
10044 Xyzzyx
10045 !! text
10046 Article for special page transclusion test
10047 !! endarticle
10048
10049 !! test
10050 Special page transclusion
10051 !! options
10052 !! input
10053 {{Special:Prefixindex/Xyzzyx}}
10054 !! result
10055 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
10056
10057 !! end
10058
10059 !! test
10060 Special page transclusion twice (bug 5021)
10061 !! options
10062 !! input
10063 {{Special:Prefixindex/Xyzzyx}}
10064 {{Special:Prefixindex/Xyzzyx}}
10065 !! result
10066 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
10067 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
10068
10069 !! end
10070
10071 !! test
10072 Transclusion of default MediaWiki message
10073 !! input
10074 {{MediaWiki:Mainpage}}
10075 !!result
10076 <p>Main Page
10077 </p>
10078 !! end
10079
10080 !! test
10081 Transclusion of nonexistent MediaWiki message
10082 !! input
10083 {{MediaWiki:Mainpagexxx}}
10084 !!result
10085 <p><a href="/index.php?title=MediaWiki:Mainpagexxx&amp;action=edit&amp;redlink=1" class="new" title="MediaWiki:Mainpagexxx (page does not exist)">MediaWiki:Mainpagexxx</a>
10086 </p>
10087 !! end
10088
10089 !! test
10090 Transclusion of MediaWiki message with underscore
10091 !! input
10092 {{MediaWiki:history_short}}
10093 !! result
10094 <p>History
10095 </p>
10096 !! end
10097
10098 !! test
10099 Transclusion of MediaWiki message with space
10100 !! input
10101 {{MediaWiki:history short}}
10102 !! result
10103 <p>History
10104 </p>
10105 !! end
10106
10107 !! test
10108 Invalid header with following text
10109 !! input
10110 = x = y
10111 !! result
10112 <p>= x = y
10113 </p>
10114 !! end
10115
10116
10117 !! test
10118 Section extraction test (section 0)
10119 !! options
10120 section=0
10121 !! input
10122 start
10123 ==a==
10124 ===aa===
10125 ====aaa====
10126 ==b==
10127 ===ba===
10128 ===bb===
10129 ====bba====
10130 ===bc===
10131 ==c==
10132 ===ca===
10133 !! result
10134 start
10135 !! end
10136
10137 !! test
10138 Section extraction test (section 1)
10139 !! options
10140 section=1
10141 !! input
10142 start
10143 ==a==
10144 ===aa===
10145 ====aaa====
10146 ==b==
10147 ===ba===
10148 ===bb===
10149 ====bba====
10150 ===bc===
10151 ==c==
10152 ===ca===
10153 !! result
10154 ==a==
10155 ===aa===
10156 ====aaa====
10157 !! end
10158
10159 !! test
10160 Section extraction test (section 2)
10161 !! options
10162 section=2
10163 !! input
10164 start
10165 ==a==
10166 ===aa===
10167 ====aaa====
10168 ==b==
10169 ===ba===
10170 ===bb===
10171 ====bba====
10172 ===bc===
10173 ==c==
10174 ===ca===
10175 !! result
10176 ===aa===
10177 ====aaa====
10178 !! end
10179
10180 !! test
10181 Section extraction test (section 3)
10182 !! options
10183 section=3
10184 !! input
10185 start
10186 ==a==
10187 ===aa===
10188 ====aaa====
10189 ==b==
10190 ===ba===
10191 ===bb===
10192 ====bba====
10193 ===bc===
10194 ==c==
10195 ===ca===
10196 !! result
10197 ====aaa====
10198 !! end
10199
10200 !! test
10201 Section extraction test (section 4)
10202 !! options
10203 section=4
10204 !! input
10205 start
10206 ==a==
10207 ===aa===
10208 ====aaa====
10209 ==b==
10210 ===ba===
10211 ===bb===
10212 ====bba====
10213 ===bc===
10214 ==c==
10215 ===ca===
10216 !! result
10217 ==b==
10218 ===ba===
10219 ===bb===
10220 ====bba====
10221 ===bc===
10222 !! end
10223
10224 !! test
10225 Section extraction test (section 5)
10226 !! options
10227 section=5
10228 !! input
10229 start
10230 ==a==
10231 ===aa===
10232 ====aaa====
10233 ==b==
10234 ===ba===
10235 ===bb===
10236 ====bba====
10237 ===bc===
10238 ==c==
10239 ===ca===
10240 !! result
10241 ===ba===
10242 !! end
10243
10244 !! test
10245 Section extraction test (section 6)
10246 !! options
10247 section=6
10248 !! input
10249 start
10250 ==a==
10251 ===aa===
10252 ====aaa====
10253 ==b==
10254 ===ba===
10255 ===bb===
10256 ====bba====
10257 ===bc===
10258 ==c==
10259 ===ca===
10260 !! result
10261 ===bb===
10262 ====bba====
10263 !! end
10264
10265 !! test
10266 Section extraction test (section 7)
10267 !! options
10268 section=7
10269 !! input
10270 start
10271 ==a==
10272 ===aa===
10273 ====aaa====
10274 ==b==
10275 ===ba===
10276 ===bb===
10277 ====bba====
10278 ===bc===
10279 ==c==
10280 ===ca===
10281 !! result
10282 ====bba====
10283 !! end
10284
10285 !! test
10286 Section extraction test (section 8)
10287 !! options
10288 section=8
10289 !! input
10290 start
10291 ==a==
10292 ===aa===
10293 ====aaa====
10294 ==b==
10295 ===ba===
10296 ===bb===
10297 ====bba====
10298 ===bc===
10299 ==c==
10300 ===ca===
10301 !! result
10302 ===bc===
10303 !! end
10304
10305 !! test
10306 Section extraction test (section 9)
10307 !! options
10308 section=9
10309 !! input
10310 start
10311 ==a==
10312 ===aa===
10313 ====aaa====
10314 ==b==
10315 ===ba===
10316 ===bb===
10317 ====bba====
10318 ===bc===
10319 ==c==
10320 ===ca===
10321 !! result
10322 ==c==
10323 ===ca===
10324 !! end
10325
10326 !! test
10327 Section extraction test (section 10)
10328 !! options
10329 section=10
10330 !! input
10331 start
10332 ==a==
10333 ===aa===
10334 ====aaa====
10335 ==b==
10336 ===ba===
10337 ===bb===
10338 ====bba====
10339 ===bc===
10340 ==c==
10341 ===ca===
10342 !! result
10343 ===ca===
10344 !! end
10345
10346 !! test
10347 Section extraction test (nonexistent section 11)
10348 !! options
10349 section=11
10350 !! input
10351 start
10352 ==a==
10353 ===aa===
10354 ====aaa====
10355 ==b==
10356 ===ba===
10357 ===bb===
10358 ====bba====
10359 ===bc===
10360 ==c==
10361 ===ca===
10362 !! result
10363 !! end
10364
10365 !! test
10366 Section extraction test with bogus heading (section 1)
10367 !! options
10368 section=1
10369 !! input
10370 ==a==
10371 ==bogus== not a legal section
10372 ==b==
10373 !! result
10374 ==a==
10375 ==bogus== not a legal section
10376 !! end
10377
10378 !! test
10379 Section extraction test with bogus heading (section 2)
10380 !! options
10381 section=2
10382 !! input
10383 ==a==
10384 ==bogus== not a legal section
10385 ==b==
10386 !! result
10387 ==b==
10388 !! end
10389
10390 !! test
10391 Section extraction test with comment after heading (section 1)
10392 !! options
10393 section=1
10394 !! input
10395 ==a==
10396 ==b== <!-- -->
10397 ==c==
10398 !! result
10399 ==a==
10400 !! end
10401
10402 !! test
10403 Section extraction test with comment after heading (section 2)
10404 !! options
10405 section=2
10406 !! input
10407 ==a==
10408 ==b== <!-- -->
10409 ==c==
10410 !! result
10411 ==b== <!-- -->
10412 !! end
10413
10414 !! test
10415 Section extraction test with bogus <nowiki> heading (section 1)
10416 !! options
10417 section=1
10418 !! input
10419 ==a==
10420 ==bogus== <nowiki>not a legal section</nowiki>
10421 ==b==
10422 !! result
10423 ==a==
10424 ==bogus== <nowiki>not a legal section</nowiki>
10425 !! end
10426
10427 !! test
10428 Section extraction test with bogus <nowiki> heading (section 2)
10429 !! options
10430 section=2
10431 !! input
10432 ==a==
10433 ==bogus== <nowiki>not a legal section</nowiki>
10434 ==b==
10435 !! result
10436 ==b==
10437 !! end
10438
10439
10440 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
10441 # instead of respecting commented sections
10442 !! test
10443 Section extraction prefixed by comment (section 1)
10444 !! options
10445 section=1
10446 !! input
10447 <!-- -->==sec1==
10448 ==sec2==
10449 !!result
10450 ==sec2==
10451 !!end
10452
10453 !! test
10454 Section extraction prefixed by comment (section 2)
10455 !! options
10456 section=2
10457 !! input
10458 <!-- -->==sec1==
10459 ==sec2==
10460 !!result
10461
10462 !!end
10463
10464
10465 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
10466 # instead of respecting HTML-style headings
10467 !! test
10468 Section extraction, mixed wiki and html (section 1)
10469 !! options
10470 section=1
10471 !! input
10472 <h2>unmarked</h2>
10473 unmarked
10474 ==1==
10475 one
10476 ==2==
10477 two
10478 !! result
10479 ==1==
10480 one
10481 !! end
10482
10483 !! test
10484 Section extraction, mixed wiki and html (section 2)
10485 !! options
10486 section=2
10487 !! input
10488 <h2>unmarked</h2>
10489 unmarked
10490 ==1==
10491 one
10492 ==2==
10493 two
10494 !! result
10495 ==2==
10496 two
10497 !! end
10498
10499
10500 # Formerly testing for bug 3342
10501 !! test
10502 Section extraction, heading surrounded by <noinclude>
10503 !! options
10504 section=1
10505 !! input
10506 <noinclude>==unmarked==</noinclude>
10507 ==marked==
10508 !! result
10509 ==marked==
10510 !!end
10511
10512 # Test behavior of bug 19910
10513 !! test
10514 Sectiion with all-equals
10515 !! options
10516 section=2
10517 !! input
10518 ===
10519 The line above must have a trailing space
10520 === <!--
10521 --> <!-- -->
10522 But just in case it doesn't...
10523 !! result
10524 === <!--
10525 --> <!-- -->
10526 But just in case it doesn't...
10527 !! end
10528
10529 !! test
10530 Section replacement test (section 0)
10531 !! options
10532 replace=0,"xxx"
10533 !! input
10534 start
10535 ==a==
10536 ===aa===
10537 ====aaa====
10538 ==b==
10539 ===ba===
10540 ===bb===
10541 ====bba====
10542 ===bc===
10543 ==c==
10544 ===ca===
10545 !! result
10546 xxx
10547
10548 ==a==
10549 ===aa===
10550 ====aaa====
10551 ==b==
10552 ===ba===
10553 ===bb===
10554 ====bba====
10555 ===bc===
10556 ==c==
10557 ===ca===
10558 !! end
10559
10560 !! test
10561 Section replacement test (section 1)
10562 !! options
10563 replace=1,"xxx"
10564 !! input
10565 start
10566 ==a==
10567 ===aa===
10568 ====aaa====
10569 ==b==
10570 ===ba===
10571 ===bb===
10572 ====bba====
10573 ===bc===
10574 ==c==
10575 ===ca===
10576 !! result
10577 start
10578 xxx
10579
10580 ==b==
10581 ===ba===
10582 ===bb===
10583 ====bba====
10584 ===bc===
10585 ==c==
10586 ===ca===
10587 !! end
10588
10589 !! test
10590 Section replacement test (section 2)
10591 !! options
10592 replace=2,"xxx"
10593 !! input
10594 start
10595 ==a==
10596 ===aa===
10597 ====aaa====
10598 ==b==
10599 ===ba===
10600 ===bb===
10601 ====bba====
10602 ===bc===
10603 ==c==
10604 ===ca===
10605 !! result
10606 start
10607 ==a==
10608 xxx
10609
10610 ==b==
10611 ===ba===
10612 ===bb===
10613 ====bba====
10614 ===bc===
10615 ==c==
10616 ===ca===
10617 !! end
10618
10619 !! test
10620 Section replacement test (section 3)
10621 !! options
10622 replace=3,"xxx"
10623 !! input
10624 start
10625 ==a==
10626 ===aa===
10627 ====aaa====
10628 ==b==
10629 ===ba===
10630 ===bb===
10631 ====bba====
10632 ===bc===
10633 ==c==
10634 ===ca===
10635 !! result
10636 start
10637 ==a==
10638 ===aa===
10639 xxx
10640
10641 ==b==
10642 ===ba===
10643 ===bb===
10644 ====bba====
10645 ===bc===
10646 ==c==
10647 ===ca===
10648 !! end
10649
10650 !! test
10651 Section replacement test (section 4)
10652 !! options
10653 replace=4,"xxx"
10654 !! input
10655 start
10656 ==a==
10657 ===aa===
10658 ====aaa====
10659 ==b==
10660 ===ba===
10661 ===bb===
10662 ====bba====
10663 ===bc===
10664 ==c==
10665 ===ca===
10666 !! result
10667 start
10668 ==a==
10669 ===aa===
10670 ====aaa====
10671 xxx
10672
10673 ==c==
10674 ===ca===
10675 !! end
10676
10677 !! test
10678 Section replacement test (section 5)
10679 !! options
10680 replace=5,"xxx"
10681 !! input
10682 start
10683 ==a==
10684 ===aa===
10685 ====aaa====
10686 ==b==
10687 ===ba===
10688 ===bb===
10689 ====bba====
10690 ===bc===
10691 ==c==
10692 ===ca===
10693 !! result
10694 start
10695 ==a==
10696 ===aa===
10697 ====aaa====
10698 ==b==
10699 xxx
10700
10701 ===bb===
10702 ====bba====
10703 ===bc===
10704 ==c==
10705 ===ca===
10706 !! end
10707
10708 !! test
10709 Section replacement test (section 6)
10710 !! options
10711 replace=6,"xxx"
10712 !! input
10713 start
10714 ==a==
10715 ===aa===
10716 ====aaa====
10717 ==b==
10718 ===ba===
10719 ===bb===
10720 ====bba====
10721 ===bc===
10722 ==c==
10723 ===ca===
10724 !! result
10725 start
10726 ==a==
10727 ===aa===
10728 ====aaa====
10729 ==b==
10730 ===ba===
10731 xxx
10732
10733 ===bc===
10734 ==c==
10735 ===ca===
10736 !! end
10737
10738 !! test
10739 Section replacement test (section 7)
10740 !! options
10741 replace=7,"xxx"
10742 !! input
10743 start
10744 ==a==
10745 ===aa===
10746 ====aaa====
10747 ==b==
10748 ===ba===
10749 ===bb===
10750 ====bba====
10751 ===bc===
10752 ==c==
10753 ===ca===
10754 !! result
10755 start
10756 ==a==
10757 ===aa===
10758 ====aaa====
10759 ==b==
10760 ===ba===
10761 ===bb===
10762 xxx
10763
10764 ===bc===
10765 ==c==
10766 ===ca===
10767 !! end
10768
10769 !! test
10770 Section replacement test (section 8)
10771 !! options
10772 replace=8,"xxx"
10773 !! input
10774 start
10775 ==a==
10776 ===aa===
10777 ====aaa====
10778 ==b==
10779 ===ba===
10780 ===bb===
10781 ====bba====
10782 ===bc===
10783 ==c==
10784 ===ca===
10785 !! result
10786 start
10787 ==a==
10788 ===aa===
10789 ====aaa====
10790 ==b==
10791 ===ba===
10792 ===bb===
10793 ====bba====
10794 xxx
10795
10796 ==c==
10797 ===ca===
10798 !!end
10799
10800 !! test
10801 Section replacement test (section 9)
10802 !! options
10803 replace=9,"xxx"
10804 !! input
10805 start
10806 ==a==
10807 ===aa===
10808 ====aaa====
10809 ==b==
10810 ===ba===
10811 ===bb===
10812 ====bba====
10813 ===bc===
10814 ==c==
10815 ===ca===
10816 !! result
10817 start
10818 ==a==
10819 ===aa===
10820 ====aaa====
10821 ==b==
10822 ===ba===
10823 ===bb===
10824 ====bba====
10825 ===bc===
10826 xxx
10827 !! end
10828
10829 !! test
10830 Section replacement test (section 10)
10831 !! options
10832 replace=10,"xxx"
10833 !! input
10834 start
10835 ==a==
10836 ===aa===
10837 ====aaa====
10838 ==b==
10839 ===ba===
10840 ===bb===
10841 ====bba====
10842 ===bc===
10843 ==c==
10844 ===ca===
10845 !! result
10846 start
10847 ==a==
10848 ===aa===
10849 ====aaa====
10850 ==b==
10851 ===ba===
10852 ===bb===
10853 ====bba====
10854 ===bc===
10855 ==c==
10856 xxx
10857 !! end
10858
10859 !! test
10860 Section replacement test with initial whitespace (bug 13728)
10861 !! options
10862 replace=2,"xxx"
10863 !! input
10864 Preformatted initial line
10865 ==a==
10866 ===a===
10867 !! result
10868 Preformatted initial line
10869 ==a==
10870 xxx
10871 !! end
10872
10873
10874 !! test
10875 Section extraction, heading followed by pre with 20 spaces (bug 6398)
10876 !! options
10877 section=1
10878 !! input
10879 ==a==
10880 a
10881 !! result
10882 ==a==
10883 a
10884 !! end
10885
10886 !! test
10887 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
10888 !! options
10889 section=1
10890 !! input
10891 ==a==
10892 a
10893 !! result
10894 ==a==
10895 a
10896 !! end
10897
10898
10899 !! test
10900 Section extraction, <pre> around bogus header (bug 10309)
10901 !! options
10902 noxml section=2
10903 !! input
10904 == Section One ==
10905 <pre>
10906 =======
10907 </pre>
10908
10909 == Section Two ==
10910 stuff
10911 !! result
10912 == Section Two ==
10913 stuff
10914 !! end
10915
10916 !! test
10917 Section replacement, <pre> around bogus header (bug 10309)
10918 !! options
10919 noxml replace=2,"xxx"
10920 !! input
10921 == Section One ==
10922 <pre>
10923 =======
10924 </pre>
10925
10926 == Section Two ==
10927 stuff
10928 !! result
10929 == Section One ==
10930 <pre>
10931 =======
10932 </pre>
10933
10934 xxx
10935 !! end
10936
10937
10938
10939 !! test
10940 Handling of &#x0A; in URLs
10941 !! input
10942 **irc://&#x0A;a
10943 !! result
10944 <ul><li><ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a>
10945 </li></ul>
10946 </li></ul>
10947
10948 !!end
10949
10950 !! test
10951 5 quotes, code coverage +1 line (php)
10952 !! options
10953 php
10954 !! input
10955 '''''
10956 !! result
10957 !! end
10958 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
10959 !! test
10960 5 quotes, code coverage +1 line (parsoid)
10961 !! options
10962 parsoid
10963 !! input
10964 '''''
10965 !! result
10966 <p><i><b></b></i></p>
10967 !! end
10968
10969 !! test
10970 Special:Search page linking.
10971 !! input
10972 {{Special:search}}
10973 !! result
10974 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
10975 </p>
10976 !! end
10977
10978 !! test
10979 Say the magic word
10980 !! input
10981 * {{PAGENAME}}
10982 * {{BASEPAGENAME}}
10983 * {{SUBPAGENAME}}
10984 * {{SUBPAGENAMEE}}
10985 * {{ROOTPAGENAME}}
10986 * {{ROOTPAGENAMEE}}
10987 * {{BASEPAGENAME}}
10988 * {{BASEPAGENAMEE}}
10989 * {{TALKPAGENAME}}
10990 * {{TALKPAGENAMEE}}
10991 * {{SUBJECTPAGENAME}}
10992 * {{SUBJECTPAGENAMEE}}
10993 * {{NAMESPACEE}}
10994 * {{NAMESPACE}}
10995 * {{TALKSPACE}}
10996 * {{TALKSPACEE}}
10997 * {{SUBJECTSPACE}}
10998 * {{SUBJECTSPACEE}}
10999 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
11000 !! result
11001 <ul><li> Parser test
11002 </li><li> Parser test
11003 </li><li> Parser test
11004 </li><li> Parser_test
11005 </li><li> Parser test
11006 </li><li> Parser_test
11007 </li><li> Parser test
11008 </li><li> Parser_test
11009 </li><li> Talk:Parser test
11010 </li><li> Talk:Parser_test
11011 </li><li> Parser test
11012 </li><li> Parser_test
11013 </li><li>
11014 </li><li>
11015 </li><li> Talk
11016 </li><li> Talk
11017 </li><li>
11018 </li><li>
11019 </li><li> <a href="/index.php?title=Template:Dynamic&amp;action=edit&amp;redlink=1" class="new" title="Template:Dynamic (page does not exist)">Template:Dynamic</a>
11020 </li></ul>
11021
11022 !! end
11023 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
11024
11025 !! test
11026 Gallery
11027 !! input
11028 <gallery>
11029 image1.png |
11030 image2.gif|||||
11031
11032 image3|
11033 image4 |300px| centre
11034 image5.svg| http://///////
11035 [[x|xx]]]]
11036 * image6
11037 </gallery>
11038 !! result
11039 <ul class="gallery">
11040 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11041 <div style="height: 150px;">Image1.png</div>
11042 <div class="gallerytext">
11043 </div>
11044 </div></li>
11045 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11046 <div style="height: 150px;">Image2.gif</div>
11047 <div class="gallerytext">
11048 <p>||||
11049 </p>
11050 </div>
11051 </div></li>
11052 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11053 <div style="height: 150px;">Image3</div>
11054 <div class="gallerytext">
11055 </div>
11056 </div></li>
11057 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11058 <div style="height: 150px;">Image4</div>
11059 <div class="gallerytext">
11060 <p>300px| centre
11061 </p>
11062 </div>
11063 </div></li>
11064 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11065 <div style="height: 150px;">Image5.svg</div>
11066 <div class="gallerytext">
11067 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
11068 </p>
11069 </div>
11070 </div></li>
11071 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11072 <div style="height: 150px;">* image6</div>
11073 <div class="gallerytext">
11074 </div>
11075 </div></li>
11076 </ul>
11077
11078 !! end
11079
11080 !! test
11081 Gallery (with options)
11082 !! input
11083 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
11084 File:Nonexistant.jpg|caption
11085 File:Nonexistant.jpg
11086 image:foobar.jpg|some '''caption''' [[Main Page]]
11087 image:foobar.jpg
11088 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
11089 </gallery>
11090 !! result
11091 <ul class="gallery" style="max-width: 226px;_width: 226px;">
11092 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
11093 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11094 <div style="height: 70px;">Nonexistant.jpg</div>
11095 <div class="gallerytext">
11096 <p>caption
11097 </p>
11098 </div>
11099 </div></li>
11100 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11101 <div style="height: 70px;">Nonexistant.jpg</div>
11102 <div class="gallerytext">
11103 </div>
11104 </div></li>
11105 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11106 <div class="thumb" style="width: 100px;"><div style="margin:31px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" width="70" height="8" /></a></div></div>
11107 <div class="gallerytext">
11108 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11109 </p>
11110 </div>
11111 </div></li>
11112 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11113 <div class="thumb" style="width: 100px;"><div style="margin:31px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" width="70" height="8" /></a></div></div>
11114 <div class="gallerytext">
11115 </div>
11116 </div></li>
11117 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11118 <div class="thumb" style="width: 100px;"><div style="margin:31px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="This is a foo-bar." src="http://example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" width="70" height="8" /></a></div></div>
11119 <div class="gallerytext">
11120 <p>Blabla|blabla.
11121 </p>
11122 </div>
11123 </div></li>
11124 </ul>
11125
11126 !! end
11127
11128 !! test
11129 Gallery with wikitext inside caption
11130 !! input
11131 <gallery>
11132 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
11133 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
11134 </gallery>
11135 !! result
11136 <ul class="gallery">
11137 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11138 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="galleryalt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
11139 <div class="gallerytext">
11140 <p><a href="/wiki/File:Foobar.jpg" class="image" title="desc"><img alt="inneralt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/20px-Foobar.jpg" width="20" height="2" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/30px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/40px-Foobar.jpg 2x" /></a>
11141 </p>
11142 </div>
11143 </div></li>
11144 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11145 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="galleryalt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
11146 <div class="gallerytext">
11147 <p>This is a test template
11148 </p>
11149 </div>
11150 </div></li>
11151 </ul>
11152
11153 !! end
11154
11155 !! test
11156 gallery (with showfilename option)
11157 !! input
11158 <gallery showfilename>
11159 File:Nonexistant.jpg|caption
11160 File:Nonexistant.jpg
11161 image:foobar.jpg|some '''caption''' [[Main Page]]
11162 File:Foobar.jpg
11163 </gallery>
11164 !! result
11165 <ul class="gallery">
11166 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11167 <div style="height: 150px;">Nonexistant.jpg</div>
11168 <div class="gallerytext">
11169 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
11170 caption
11171 </p>
11172 </div>
11173 </div></li>
11174 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11175 <div style="height: 150px;">Nonexistant.jpg</div>
11176 <div class="gallerytext">
11177 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
11178 </p>
11179 </div>
11180 </div></li>
11181 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11182 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
11183 <div class="gallerytext">
11184 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
11185 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11186 </p>
11187 </div>
11188 </div></li>
11189 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11190 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
11191 <div class="gallerytext">
11192 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
11193 </p>
11194 </div>
11195 </div></li>
11196 </ul>
11197
11198 !! end
11199
11200 !! test
11201 Gallery (with namespace-less filenames)
11202 !! input
11203 <gallery>
11204 File:Nonexistant.jpg
11205 Nonexistant.jpg
11206 image:foobar.jpg
11207 foobar.jpg
11208 </gallery>
11209 !! result
11210 <ul class="gallery">
11211 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11212 <div style="height: 150px;">Nonexistant.jpg</div>
11213 <div class="gallerytext">
11214 </div>
11215 </div></li>
11216 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11217 <div style="height: 150px;">Nonexistant.jpg</div>
11218 <div class="gallerytext">
11219 </div>
11220 </div></li>
11221 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11222 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
11223 <div class="gallerytext">
11224 </div>
11225 </div></li>
11226 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11227 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
11228 <div class="gallerytext">
11229 </div>
11230 </div></li>
11231 </ul>
11232
11233 !! end
11234
11235 !! test
11236 HTML Hex character encoding (spells the word "JavaScript")
11237 !! input
11238 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
11239 !! result
11240 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
11241 </p>
11242 !! end
11243
11244 !! test
11245 HTML Hex character encoding bogus encoding (bug 26437 regression check)
11246 !! input
11247 &#xsee;&#XSEE;
11248 !! result
11249 <p>&amp;#xsee;&amp;#XSEE;
11250 </p>
11251 !! end
11252
11253 !! test
11254 HTML Hex character encoding mixed case
11255 !! input
11256 &#xEE;&#Xee;
11257 !! result
11258 <p>&#xee;&#xee;
11259 </p>
11260 !! end
11261
11262 !! test
11263 __FORCETOC__ override
11264 !! input
11265 __NEWSECTIONLINK__
11266 __FORCETOC__
11267 !! result
11268 <p><br />
11269 </p>
11270 !! end
11271
11272 !! test
11273 ISBN code coverage
11274 !! input
11275 ISBN 978-0-1234-56&#x20;789
11276 !! result
11277 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
11278 </p>
11279 !! end
11280
11281 !! test
11282 ISBN followed by 5 spaces
11283 !! input
11284 ISBN
11285 !! result
11286 <p>ISBN
11287 </p>
11288 !! end
11289
11290 !! test
11291 Double ISBN
11292 !! input
11293 ISBN ISBN 1234567890
11294 !! result
11295 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
11296 </p>
11297 !! end
11298
11299 !! test
11300 Bug 22905: <abbr> followed by ISBN followed by </a>
11301 !! input
11302 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
11303 !! result
11304 <p><abbr>(fr)</abbr> <a href="/wiki/Special:BookSources/2753300917" class="internal mw-magiclink-isbn">ISBN 2753300917</a> <a rel="nofollow" class="external text" href="http://www.example.com">example.com</a>
11305 </p>
11306 !! end
11307
11308 !! test
11309 Double RFC
11310 !! input
11311 RFC RFC 1234
11312 !! result
11313 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
11314 </p>
11315 !! end
11316
11317 !! test
11318 Double RFC with a wiki link
11319 !! input
11320 RFC [[RFC 1234]]
11321 !! result
11322 <p>RFC <a href="/index.php?title=RFC_1234&amp;action=edit&amp;redlink=1" class="new" title="RFC 1234 (page does not exist)">RFC 1234</a>
11323 </p>
11324 !! end
11325
11326 !! test
11327 RFC code coverage
11328 !! input
11329 RFC 983&#x20;987
11330 !! result
11331 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
11332 </p>
11333 !! end
11334
11335 !! test
11336 Centre-aligned image
11337 !! input
11338 [[Image:foobar.jpg|centre]]
11339 !! result
11340 <div class="center"><div class="floatnone"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div></div>
11341
11342 !!end
11343
11344 !! test
11345 None-aligned image
11346 !! input
11347 [[Image:foobar.jpg|none]]
11348 !! result
11349 <div class="floatnone"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
11350
11351 !!end
11352
11353 !! test
11354 Width + Height sized image (using px) (height is ignored)
11355 !! input
11356 [[Image:foobar.jpg|640x480px]]
11357 !! result
11358 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg" width="640" height="73" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/960px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/1280px-Foobar.jpg 2x" /></a>
11359 </p>
11360 !!end
11361
11362 !! test
11363 Width-sized image (using px, no following whitespace)
11364 !! input
11365 [[Image:foobar.jpg|640px]]
11366 !! result
11367 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg" width="640" height="73" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/960px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/1280px-Foobar.jpg 2x" /></a>
11368 </p>
11369 !!end
11370
11371 !! test
11372 Width-sized image (using px, with following whitespace - test regression from r39467)
11373 !! input
11374 [[Image:foobar.jpg|640px ]]
11375 !! result
11376 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg" width="640" height="73" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/960px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/1280px-Foobar.jpg 2x" /></a>
11377 </p>
11378 !!end
11379
11380 !! test
11381 Width-sized image (using px, with preceding whitespace - test regression from r39467)
11382 !! input
11383 [[Image:foobar.jpg| 640px]]
11384 !! result
11385 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg" width="640" height="73" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/960px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/1280px-Foobar.jpg 2x" /></a>
11386 </p>
11387 !!end
11388
11389 !! test
11390 Another italics / bold test
11391 !! input
11392 ''' ''x'
11393 !! result
11394 <pre>'<i> </i>x'
11395 </pre>
11396 !!end
11397
11398 # Note the results may be incorrect, as parserTest output included this:
11399 # XML error: Mismatched tag at byte 6120:
11400 # ...<dd> </dt></dl> </dd...
11401 !! test
11402 dt/dd/dl test
11403 !! options
11404 disabled
11405 !! input
11406 :;;;::
11407 !! result
11408 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd>
11409 </dd></dl>
11410 </dd></dl>
11411 </dt></dl>
11412 </dt></dl>
11413 </dt></dl>
11414 </dd></dl>
11415
11416 !!end
11417
11418
11419 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
11420 !! test
11421 Images with the "|" character in the comment
11422 !! input
11423 [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
11424 !! result
11425 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>An <a rel="nofollow" class="external text" href="http://test/?param1=%7Cleft%7C&amp;param2=%7Cx">external</a> URL</div></div></div>
11426
11427 !!end
11428
11429 !! test
11430 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
11431 !! input
11432 <html><script>alert(1);</script></html>
11433 !! result
11434 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
11435 </p>
11436 !! end
11437
11438 !! test
11439 HTML with raw HTML ($wgRawHtml==true)
11440 !! options
11441 rawhtml
11442 !! input
11443 <html><script>alert(1);</script></html>
11444 !! result
11445 <p><script>alert(1);</script>
11446 </p>
11447 !! end
11448
11449 !! test
11450 Parents of subpages, one level up
11451 !! options
11452 subpage title=[[Subpage test/L1/L2/L3]]
11453 !! input
11454 [[../|L2]]
11455 !! result
11456 <p><a href="/index.php?title=Subpage_test/L1/L2&amp;action=edit&amp;redlink=1" class="new" title="Subpage test/L1/L2 (page does not exist)">L2</a>
11457 </p>
11458 !! end
11459
11460
11461 !! test
11462 Parents of subpages, one level up, not named
11463 !! options
11464 subpage title=[[Subpage test/L1/L2/L3]]
11465 !! input
11466 [[../]]
11467 !! result
11468 <p><a href="/index.php?title=Subpage_test/L1/L2&amp;action=edit&amp;redlink=1" class="new" title="Subpage test/L1/L2 (page does not exist)">Subpage test/L1/L2</a>
11469 </p>
11470 !! end
11471
11472
11473
11474 !! test
11475 Parents of subpages, two levels up
11476 !! options
11477 subpage title=[[Subpage test/L1/L2/L3]]
11478 !! input
11479 [[../../|L1]]2
11480
11481 [[../../|L1]]l
11482 !! result
11483 <p><a href="/index.php?title=Subpage_test/L1&amp;action=edit&amp;redlink=1" class="new" title="Subpage test/L1 (page does not exist)">L1</a>2
11484 </p><p><a href="/index.php?title=Subpage_test/L1&amp;action=edit&amp;redlink=1" class="new" title="Subpage test/L1 (page does not exist)">L1l</a>
11485 </p>
11486 !! end
11487
11488 !! test
11489 Parents of subpages, two levels up, without trailing slash or name.
11490 !! options
11491 subpage title=[[Subpage test/L1/L2/L3]]
11492 !! input
11493 [[../..]]
11494 !! result
11495 <p>[[../..]]
11496 </p>
11497 !! end
11498
11499 !! test
11500 Parents of subpages, two levels up, with lots of extra trailing slashes.
11501 !! options
11502 subpage title=[[Subpage test/L1/L2/L3]]
11503 !! input
11504 [[../../////]]
11505 !! result
11506 <p><a href="/index.php?title=Subpage_test/L1////&amp;action=edit&amp;redlink=1" class="new" title="Subpage test/L1//// (page does not exist)">///</a>
11507 </p>
11508 !! end
11509
11510 !! test
11511 Definition list code coverage
11512 !! input
11513 ; title : def
11514 ; title : def
11515 ;title: def
11516 !! result
11517 <dl><dt> title &#160;</dt><dd> def
11518 </dd><dt> title&#160;</dt><dd> def
11519 </dd><dt>title</dt><dd> def
11520 </dd></dl>
11521
11522 !! end
11523
11524 !! test
11525 Don't fall for the self-closing div
11526 !! input
11527 <div>hello world</div/>
11528 !! result
11529 <div>hello world</div>
11530
11531 !! end
11532
11533 !! test
11534 MSGNW magic word
11535 !! input
11536 {{MSGNW:msg}}
11537 !! result
11538 <p>&#91;&#91;:Template:Msg&#93;&#93;
11539 </p>
11540 !! end
11541
11542 !! test
11543 RAW magic word
11544 !! input
11545 {{RAW:QUERTY}}
11546 !! result
11547 <p><a href="/index.php?title=Template:QUERTY&amp;action=edit&amp;redlink=1" class="new" title="Template:QUERTY (page does not exist)">Template:QUERTY</a>
11548 </p>
11549 !! end
11550
11551 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
11552 !! test
11553 Always escape literal '>' in output, not just after '<'
11554 !! input
11555 ><>
11556 !! result
11557 <p>&gt;&lt;&gt;
11558 </p>
11559 !! end
11560
11561 !! test
11562 Template caching
11563 !! input
11564 {{Test}}
11565 {{Test}}
11566 !! result
11567 <p>This is a test template
11568 This is a test template
11569 </p>
11570 !! end
11571
11572
11573 !! article
11574 MediaWiki:Fake
11575 !! text
11576 ==header==
11577 !! endarticle
11578
11579 !! test
11580 Inclusion of !userCanEdit() content
11581 !! input
11582 {{MediaWiki:Fake}}
11583 !! result
11584 <h2><span class="editsection">[<a href="/index.php?title=MediaWiki:Fake&amp;action=edit&amp;section=T-1" title="MediaWiki:Fake">edit</a>]</span> <span class="mw-headline" id="header">header</span></h2>
11585
11586 !! end
11587
11588
11589 !! test
11590 Out-of-order TOC heading levels
11591 !! input
11592 ==2==
11593 ======6======
11594 ===3===
11595 =1=
11596 =====5=====
11597 ==2==
11598 !! result
11599 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
11600 <ul>
11601 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
11602 <ul>
11603 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
11604 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
11605 </ul>
11606 </li>
11607 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
11608 <ul>
11609 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
11610 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
11611 </ul>
11612 </li>
11613 </ul>
11614 </td></tr></table>
11615 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: 2">edit</a>]</span> <span class="mw-headline" id="2">2</span></h2>
11616 <h6><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: 6">edit</a>]</span> <span class="mw-headline" id="6">6</span></h6>
11617 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: 3">edit</a>]</span> <span class="mw-headline" id="3">3</span></h3>
11618 <h1><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: 1">edit</a>]</span> <span class="mw-headline" id="1">1</span></h1>
11619 <h5><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: 5">edit</a>]</span> <span class="mw-headline" id="5">5</span></h5>
11620 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: 2">edit</a>]</span> <span class="mw-headline" id="2_2">2</span></h2>
11621
11622 !! end
11623
11624
11625 !! test
11626 ISBN with a dummy number
11627 !! input
11628 ISBN ---
11629 !! result
11630 <p>ISBN ---
11631 </p>
11632 !! end
11633
11634
11635 !! test
11636 ISBN with space-delimited number
11637 !! input
11638 ISBN 92 9017 032 8
11639 !! result
11640 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
11641 </p>
11642 !! end
11643
11644
11645 !! test
11646 ISBN with multiple spaces, no number
11647 !! input
11648 ISBN foo
11649 !! result
11650 <p>ISBN foo
11651 </p>
11652 !! end
11653
11654
11655 !! test
11656 ISBN length
11657 !! input
11658 ISBN 123456789
11659
11660 ISBN 1234567890
11661
11662 ISBN 12345678901
11663 !! result
11664 <p>ISBN 123456789
11665 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
11666 </p><p>ISBN 12345678901
11667 </p>
11668 !! end
11669
11670
11671 !! test
11672 ISBN with trailing year (bug 8110)
11673 !! input
11674 ISBN 1-234-56789-0 - 2006
11675
11676 ISBN 1 234 56789 0 - 2006
11677 !! result
11678 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
11679 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
11680 </p>
11681 !! end
11682
11683
11684 !! test
11685 anchorencode
11686 !! input
11687 {{anchorencode:foo bar©#%n}}
11688 !! result
11689 <p>foo_bar.C2.A9.23.25n
11690 </p>
11691 !! end
11692
11693 !! test
11694 anchorencode trims spaces
11695 !! input
11696 {{anchorencode: __pretty__please__}}
11697 !! result
11698 <p>pretty_please
11699 </p>
11700 !! end
11701
11702 !! test
11703 anchorencode deals with links
11704 !! input
11705 {{anchorencode: [[hello|world]] [[hi]]}}
11706 !! result
11707 <p>world_hi
11708 </p>
11709 !! end
11710
11711 !! test
11712 anchorencode deals with templates
11713 !! input
11714 {{anchorencode: {{Foo}} }}
11715 !! result
11716 <p>FOO
11717 </p>
11718 !! end
11719
11720 !! test
11721 anchorencode encodes like the TOC generator: (bug 18431)
11722 !! input
11723 === _ +:.3A%3A&&amp;]] ===
11724 {{anchorencode: _ +:.3A%3A&&amp;]] }}
11725 __NOEDITSECTION__
11726 !! result
11727 <h3> <span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
11728 <p>.2B:.3A.253A.26.26.5D.5D
11729 </p>
11730 !! end
11731
11732 # Expected output in the following test is not necessarily expected (there
11733 # should probably be <p> tags inside the <blockquote> in the output) -- it's
11734 # only testing for well-formedness.
11735 !! test
11736 Bug 6200: blockquotes and paragraph formatting
11737 !! input
11738 <blockquote>
11739 foo
11740 </blockquote>
11741
11742 bar
11743
11744 baz
11745 !! result
11746 <blockquote>
11747 foo
11748 </blockquote>
11749 <p>bar
11750 </p>
11751 <pre>baz
11752 </pre>
11753 !! end
11754
11755 !! test
11756 Bug 8293: Use of center tag ruins paragraph formatting
11757 !! input
11758 <center>
11759 foo
11760 </center>
11761
11762 bar
11763
11764 baz
11765 !! result
11766 <center>
11767 <p>foo
11768 </p>
11769 </center>
11770 <p>bar
11771 </p>
11772 <pre>baz
11773 </pre>
11774 !! end
11775
11776 !!test
11777 Parsing of overlapping (improperly nested) inline html tags (PHP parser)
11778 !!options
11779 php
11780 !!input
11781 <span><s>x</span></s>
11782 !!result
11783 <p><span><s>x&lt;/span&gt;</s></span>
11784 </p>
11785 !!end
11786
11787 !!test
11788 Parsing of overlapping (improperly nested) inline html tags (Parsoid)
11789 !!options
11790 parsoid
11791 !!input
11792 <span><s>x</span></s>
11793 !!result
11794 <p><span><s>x</s></span><s></s>
11795 </p>
11796 !!end
11797
11798 ###
11799 ### Language variants related tests
11800 ###
11801 !! test
11802 Self-link in language variants
11803 !! options
11804 title=[[Dunav]] language=sr
11805 !! input
11806 Both [[Dunav]] and [[Дунав]] are names for this river.
11807 !! result
11808 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
11809 </p>
11810 !!end
11811
11812 !! article
11813 Дуна
11814 !! text
11815 content
11816 !! endarticle
11817
11818 !! test
11819 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
11820 !! options
11821 title=[[Duna]] language=sr
11822 !! input
11823 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
11824 !! result
11825 <p><a href="/wiki/%D0%94%D1%83%D0%BD%D0%B0" title="Дуна">Дуна</a> is not a self-link while <strong class="selflink">Duna</strong> and <strong class="selflink">Dуна</strong> are still self-links.
11826 </p>
11827 !! end
11828
11829 !! test
11830 Link to pages in language variants
11831 !! options
11832 language=sr
11833 !! input
11834 Main Page can be written as [[Маин Паге]]
11835 !! result
11836 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
11837 </p>
11838 !!end
11839
11840
11841 !! test
11842 Multiple links to pages in language variants
11843 !! options
11844 language=sr
11845 !! input
11846 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
11847 !! result
11848 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a> can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a> same as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>.
11849 </p>
11850 !!end
11851
11852
11853 !! test
11854 Simple template in language variants
11855 !! options
11856 language=sr
11857 !! input
11858 {{тест}}
11859 !! result
11860 <p>This is a test template
11861 </p>
11862 !! end
11863
11864
11865 !! test
11866 Template with explicit namespace in language variants
11867 !! options
11868 language=sr
11869 !! input
11870 {{Template:тест}}
11871 !! result
11872 <p>This is a test template
11873 </p>
11874 !! end
11875
11876
11877 !! test
11878 Basic test for template parameter in language variants
11879 !! options
11880 language=sr
11881 !! input
11882 {{парамтест|param=foo}}
11883 !! result
11884 <p>This is a test template with parameter foo
11885 </p>
11886 !! end
11887
11888
11889 !! test
11890 Simple category in language variants
11891 !! options
11892 language=sr cat
11893 !! input
11894 [[Category:МедиаWики Усер'с Гуиде]]
11895 !! result
11896 <a href="/wiki/%D0%9A%D0%B0%D1%82%D0%B5%D0%B3%D0%BE%D1%80%D0%B8%D1%98%D0%B0:MediaWiki_User%27s_Guide" title="Категорија:MediaWiki User's Guide">MediaWiki User's Guide</a>
11897 !! end
11898
11899
11900 !! article
11901 Category:分类
11902 !! text
11903 blah
11904 !! endarticle
11905
11906 !! article
11907 Category:分類
11908 !! text
11909 blah
11910 !! endarticle
11911
11912 !! test
11913 Don't convert blue categorylinks to another variant (bug 33210)
11914 !! options
11915 language=zh cat
11916 !! input
11917 [[A]][[Category:分类]]
11918 !! result
11919 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
11920 !! end
11921
11922
11923 !! test
11924 Stripping -{}- tags (language variants)
11925 !! options
11926 language=sr
11927 !! input
11928 Latin proverb: -{Ne nuntium necare}-
11929 !! result
11930 <p>Latin proverb: Ne nuntium necare
11931 </p>
11932 !! end
11933
11934
11935 !! test
11936 Prevent conversion with -{}- tags (language variants)
11937 !! options
11938 language=sr variant=sr-ec
11939 !! input
11940 Latinski: -{Ne nuntium necare}-
11941 !! result
11942 <p>Латински: Ne nuntium necare
11943 </p>
11944 !! end
11945
11946
11947 !! test
11948 Prevent conversion of text with -{}- tags (language variants)
11949 !! options
11950 language=sr variant=sr-ec
11951 !! input
11952 Latinski: -{Ne nuntium necare}-
11953 !! result
11954 <p>Латински: Ne nuntium necare
11955 </p>
11956 !! end
11957
11958
11959 !! test
11960 Prevent conversion of links with -{}- tags (language variants)
11961 !! options
11962 language=sr variant=sr-ec
11963 !! input
11964 -{[[Main Page]]}-
11965 !! result
11966 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11967 </p>
11968 !! end
11969
11970
11971 !! test
11972 -{}- tags within headlines (within html for parserConvert())
11973 !! options
11974 language=sr variant=sr-ec
11975 !! input
11976 == -{Naslov}- ==
11977 !! result
11978 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Уредите одељак „Naslov“">уреди</a>]</span> <span class="mw-headline" id="-.7BNaslov.7D-">Naslov</span></h2>
11979
11980 !! end
11981
11982
11983 !! test
11984 Explicit definition of language variant alternatives
11985 !! options
11986 language=zh variant=zh-tw
11987 !! input
11988 -{zh:China;zh-tw:Taiwan}-, not China
11989 !! result
11990 <p>Taiwan, not China
11991 </p>
11992 !! end
11993
11994
11995 !! test
11996 Conversion around HTML tags
11997 !! options
11998 language=sr variant=sr-ec
11999 !! input
12000 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
12001 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
12002 !! result
12003 <p>
12004 <span title="ЛаCтин">ски</span>
12005 </p>
12006 !! end
12007
12008
12009 !! test
12010 Explicit session-wise language variant mapping (A flag and - flag)
12011 !! options
12012 language=zh variant=zh-tw
12013 !! input
12014 Taiwan is not China.
12015 But -{A|zh:China;zh-tw:Taiwan}- is China,
12016 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
12017 and -{China}- is China.
12018 !! result
12019 <p>Taiwan is not China.
12020 But Taiwan is Taiwan,
12021 (This should be stripped!)
12022 and China is China.
12023 </p>
12024 !! end
12025
12026 !! test
12027 Explicit session-wise language variant mapping (H flag for hide)
12028 !! options
12029 language=zh variant=zh-tw
12030 !! input
12031 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
12032 Taiwan is China.
12033 !! result
12034 <p>(This should be stripped!)
12035 Taiwan is Taiwan.
12036 </p>
12037 !! end
12038
12039 !! test
12040 Adding explicit conversion rule for title (T flag)
12041 !! options
12042 language=zh variant=zh-tw showtitle
12043 !! input
12044 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
12045 !! result
12046 Taiwan
12047 <p>Should be stripped!
12048 </p>
12049 !! end
12050
12051 !! test
12052 Testing that changing the language variant here in the tests actually works
12053 !! options
12054 language=zh variant=zh showtitle
12055 !! input
12056 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
12057 !! result
12058 China
12059 <p>Should be stripped!
12060 </p>
12061 !! end
12062
12063 !! test
12064 Recursive conversion of alt and title attrs shouldn't clear converter state
12065 !! options
12066 language=zh variant=zh-cn showtitle
12067 !! input
12068 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
12069 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
12070 !! result
12071 China
12072 <p>
12073 Should be stripped<span title="Exclamation">!</span>
12074 </p>
12075 !! end
12076
12077 !! test
12078 Bug 24072: more test on conversion rule for title
12079 !! options
12080 language=zh variant=zh-tw showtitle
12081 !! input
12082 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
12083 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
12084 !! result
12085 Taiwan
12086 <p>This should be stripped!
12087 This won't take interferes with the title rule.
12088 </p>
12089 !! end
12090
12091 !! test
12092 Raw output of variant escape tags (R flag)
12093 !! options
12094 language=zh variant=zh-tw
12095 !! input
12096 Raw: -{R|zh:China;zh-tw:Taiwan}-
12097 !! result
12098 <p>Raw: zh:China;zh-tw:Taiwan
12099 </p>
12100 !! end
12101
12102 !! test
12103 Nested using of manual convert syntax
12104 !! options
12105 language=zh variant=zh-hk
12106 !! input
12107 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
12108 !! result
12109 <p>Nested: Hello Hong Kong!
12110 </p>
12111 !! end
12112
12113 !! test
12114 Proper conversion of text in external links
12115 !! options
12116 language=sr variant=sr-ec
12117 !! input
12118 http://www.google.com
12119 gopher://www.google.com
12120 [http://www.google.com http://www.google.com]
12121 [gopher://www.google.com gopher://www.google.com]
12122 [https://www.google.com irc://www.google.com]
12123 [ftp://www.google.com www.google.com/ftp://dir]
12124 [//www.google.com www.google.com]
12125 !! result
12126 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
12127 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
12128 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
12129 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
12130 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
12131 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
12132 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
12133 </p>
12134 !! end
12135
12136 !! test
12137 Do not convert roman numbers to language variants
12138 !! options
12139 language=sr variant=sr-ec
12140 !! input
12141 Fridrih IV je car.
12142 !! result
12143 <p>Фридрих IV је цар.
12144 </p>
12145 !! end
12146
12147 !! test
12148 Unclosed language converter markup "-{"
12149 !! options
12150 language=sr
12151 !! input
12152 -{T|hello
12153 !! result
12154 <p>-{T|hello
12155 </p>
12156 !! end
12157
12158 !! test
12159 Don't convert raw rule "-{R|=&gt;}-" to "=>"
12160 !! options
12161 language=sr
12162 !! input
12163 -{R|=&gt;}-
12164 !! result
12165 <p>=&gt;
12166 </p>
12167 !!end
12168
12169 !!article
12170 Template:Bullet
12171 !!text
12172 * Bar
12173 !!endarticle
12174
12175 !! test
12176 Bug 529: Uncovered bullet
12177 !! input
12178 * Foo {{bullet}}
12179 !! result
12180 <ul><li> Foo
12181 </li><li> Bar
12182 </li></ul>
12183
12184 !! end
12185
12186 # Plain MediaWiki does not remove empty lists, but tidy actually does.
12187 # Templates in Wikipedia rely on this behavior, as tidy has always been
12188 # enabled there. These tests are normally run *without* tidy, so specify the
12189 # full output here.
12190 # To test realistic parsing behavior, apply a tidy-like transformation to both
12191 # the expected output and your parser's output.
12192 !! test
12193 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
12194 !! input
12195 ******* Foo {{bullet}}
12196 !! result
12197 <ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li> Foo
12198 </li></ul>
12199 </li></ul>
12200 </li></ul>
12201 </li></ul>
12202 </li></ul>
12203 </li></ul>
12204 </li><li> Bar
12205 </li></ul>
12206
12207 !! end
12208
12209 !! test
12210 Bug 529: Uncovered table already at line-start
12211 !! input
12212 x
12213
12214 {{table}}
12215 y
12216 !! result
12217 <p>x
12218 </p>
12219 <table>
12220 <tr>
12221 <td> 1 </td>
12222 <td> 2
12223 </td></tr>
12224 <tr>
12225 <td> 3 </td>
12226 <td> 4
12227 </td></tr></table>
12228 <p>y
12229 </p>
12230 !! end
12231
12232 !! test
12233 Bug 529: Uncovered bullet in parser function result
12234 !! input
12235 * Foo {{lc:{{bullet}} }}
12236 !! result
12237 <ul><li> Foo
12238 </li><li> bar
12239 </li></ul>
12240
12241 !! end
12242
12243 !! test
12244 Bug 5678: Double-parsed template argument
12245 !! input
12246 {{lc:{{{1}}}|hello}}
12247 !! result
12248 <p>{{{1}}}
12249 </p>
12250 !! end
12251
12252 !! test
12253 Bug 5678: Double-parsed template invocation
12254 !! input
12255 {{lc:{{paramtest {{!}} param = hello }} }}
12256 !! result
12257 <p>{{paramtest | param = hello }}
12258 </p>
12259 !! end
12260
12261 !! test
12262 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
12263 !! options
12264 language=cs
12265 title=[[Main Page]]
12266 !! input
12267 {{PRVNÍVELKÉ:ěščř}}
12268 {{prvnívelké:ěščř}}
12269 {{PRVNÍMALÉ:ěščř}}
12270 {{prvnímalé:ěščř}}
12271 {{MALÁ:ěščř}}
12272 {{malá:ěščř}}
12273 {{VELKÁ:ěščř}}
12274 {{velká:ěščř}}
12275 !! result
12276 <p>Ěščř
12277 Ěščř
12278 ěščř
12279 ěščř
12280 ěščř
12281 ěščř
12282 ĚŠČŘ
12283 ĚŠČŘ
12284 </p>
12285 !! end
12286
12287 !! test
12288 Morwen/13: Unclosed link followed by heading
12289 !! input
12290 [[link
12291 ==heading==
12292 !! result
12293 <p>[[link
12294 </p>
12295 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: heading">edit</a>]</span> <span class="mw-headline" id="heading">heading</span></h2>
12296
12297 !! end
12298
12299 !! test
12300 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
12301 !! input
12302 {{foo|
12303 =heading=
12304 !! result
12305 <p>{{foo|
12306 </p>
12307 <h1> <span class="mw-headline" id="heading">heading</span></h1>
12308
12309 !! end
12310
12311 !! test
12312 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
12313 !! input
12314 {{foo|
12315 ==heading==
12316 !! result
12317 <p>{{foo|
12318 </p>
12319 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: heading">edit</a>]</span> <span class="mw-headline" id="heading">heading</span></h2>
12320
12321 !! end
12322
12323 !! test
12324 Tildes in comments
12325 !! options
12326 pst
12327 !! input
12328 <!-- ~~~~ -->
12329 !! result
12330 <!-- ~~~~ -->
12331 !! end
12332
12333 !! test
12334 Paragraphs inside divs (no extra line breaks)
12335 !! input
12336 <div>Line one
12337
12338 Line two</div>
12339 !! result
12340 <div>Line one
12341 Line two</div>
12342
12343 !! end
12344
12345 !! test
12346 Paragraphs inside divs (extra line break on open)
12347 !! input
12348 <div>
12349 Line one
12350
12351 Line two</div>
12352 !! result
12353 <div>
12354 <p>Line one
12355 </p>
12356 Line two</div>
12357
12358 !! end
12359
12360 !! test
12361 Paragraphs inside divs (extra line break on close)
12362 !! input
12363 <div>Line one
12364
12365 Line two
12366 </div>
12367 !! result
12368 <div>Line one
12369 <p>Line two
12370 </p>
12371 </div>
12372
12373 !! end
12374
12375 !! test
12376 Paragraphs inside divs (extra line break on open and close)
12377 !! input
12378 <div>
12379 Line one
12380
12381 Line two
12382 </div>
12383 !! result
12384 <div>
12385 <p>Line one
12386 </p><p>Line two
12387 </p>
12388 </div>
12389
12390 !! end
12391
12392 !! test
12393 Nesting tags, paragraphs on lines which begin with <div>
12394 !! options
12395 disabled
12396 !! input
12397 <div></div><strong>A
12398 B</strong>
12399 !! result
12400 <div></div>
12401 <p><strong>A
12402 B</strong>
12403 </p>
12404 !! end
12405
12406 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
12407 !! test
12408 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
12409 !! options
12410 disabled
12411 !! input
12412 <blockquote>Line one
12413
12414 Line two</blockquote>
12415 !! result
12416 <blockquote>Line one
12417 Line two</blockquote>
12418
12419 !! end
12420
12421 !! test
12422 Bug 6200: paragraphs inside blockquotes (extra line break on open)
12423 !! options
12424 disabled
12425 !! input
12426 <blockquote>
12427 Line one
12428
12429 Line two</blockquote>
12430 !! result
12431 <blockquote>
12432 <p>Line one
12433 </p>
12434 Line two</blockquote>
12435
12436 !! end
12437
12438 !! test
12439 Bug 6200: paragraphs inside blockquotes (extra line break on close)
12440 !! options
12441 disabled
12442 !! input
12443 <blockquote>Line one
12444
12445 Line two
12446 </blockquote>
12447 !! result
12448 <blockquote>Line one
12449 <p>Line two
12450 </p>
12451 </blockquote>
12452
12453 !! end
12454
12455 !! test
12456 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
12457 !! options
12458 disabled
12459 !! input
12460 <blockquote>
12461 Line one
12462
12463 Line two
12464 </blockquote>
12465 !! result
12466 <blockquote>
12467 <p>Line one
12468 </p><p>Line two
12469 </p>
12470 </blockquote>
12471
12472 !! end
12473
12474 !! test
12475 Paragraphs inside blockquotes/divs (no extra line breaks)
12476 !! input
12477 <blockquote><div>Line one
12478
12479 Line two</div></blockquote>
12480 !! result
12481 <blockquote><div>Line one
12482 Line two</div></blockquote>
12483
12484 !! end
12485
12486 !! test
12487 Paragraphs inside blockquotes/divs (extra line break on open)
12488 !! input
12489 <blockquote><div>
12490 Line one
12491
12492 Line two</div></blockquote>
12493 !! result
12494 <blockquote><div>
12495 <p>Line one
12496 </p>
12497 Line two</div></blockquote>
12498
12499 !! end
12500
12501 !! test
12502 Paragraphs inside blockquotes/divs (extra line break on close)
12503 !! input
12504 <blockquote><div>Line one
12505
12506 Line two
12507 </div></blockquote>
12508 !! result
12509 <blockquote><div>Line one
12510 <p>Line two
12511 </p>
12512 </div></blockquote>
12513
12514 !! end
12515
12516 !! test
12517 Paragraphs inside blockquotes/divs (extra line break on open and close)
12518 !! input
12519 <blockquote><div>
12520 Line one
12521
12522 Line two
12523 </div></blockquote>
12524 !! result
12525 <blockquote><div>
12526 <p>Line one
12527 </p><p>Line two
12528 </p>
12529 </div></blockquote>
12530
12531 !! end
12532
12533 !! test
12534 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
12535 !! options
12536 wgLinkHolderBatchSize=0
12537 !! input
12538 [[meatball:1]]
12539 [[meatball:2]]
12540 [[meatball:3]]
12541 !! result
12542 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
12543 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
12544 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
12545 </p>
12546 !! end
12547
12548 !! test
12549 Free external link invading image caption
12550 !! input
12551 [[Image:Foobar.jpg|thumb|http://x|hello]]
12552 !! result
12553 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>hello</div></div></div>
12554
12555 !! end
12556
12557 !! test
12558 Bug 15196: localised external link numbers
12559 !! options
12560 language=fa
12561 !! input
12562 [http://en.wikipedia.org/]
12563 !! result
12564 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
12565 </p>
12566 !! end
12567
12568 !! test
12569 Multibyte character in padleft
12570 !! input
12571 {{padleft:-Hello|7|Æ}}
12572 !! result
12573 <p>Æ-Hello
12574 </p>
12575 !! end
12576
12577 !! test
12578 Multibyte character in padright
12579 !! input
12580 {{padright:Hello-|7|Æ}}
12581 !! result
12582 <p>Hello-Æ
12583 </p>
12584 !! end
12585
12586 !!test
12587 formatdate parser function
12588 !!input
12589 {{#formatdate:2009-03-24}}
12590 !! result
12591 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
12592 </p>
12593 !! end
12594
12595 !!test
12596 formatdate parser function, with default format
12597 !!input
12598 {{#formatdate:2009-03-24|mdy}}
12599 !! result
12600 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
12601 </p>
12602 !! end
12603
12604 !! test
12605 Spacing of numbers in formatted dates
12606 !! input
12607 {{#formatdate:January 15}}
12608 !! result
12609 <p><span class="mw-formatted-date" title="01-15">January 15</span>
12610 </p>
12611 !! end
12612
12613 !! test
12614 formatdate parser function, with default format and on a page of which the content language is always English and different from the wiki content language
12615 !! options
12616 language=nl title=[[MediaWiki:Common.css]]
12617 !! input
12618 {{#formatdate:2009-03-24|dmy}}
12619 !! result
12620 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
12621 </p>
12622 !! end
12623
12624 #
12625 #
12626 #
12627
12628 #
12629 # Edit comments
12630 #
12631
12632 !! test
12633 Edit comment with link
12634 !! options
12635 comment
12636 !! input
12637 I like the [[Main Page]] a lot
12638 !! result
12639 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
12640 !!end
12641
12642 !! test
12643 Edit comment with link and link text
12644 !! options
12645 comment
12646 !! input
12647 I like the [[Main Page|best pages]] a lot
12648 !! result
12649 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
12650 !!end
12651
12652 !! test
12653 Edit comment with link and link text with suffix
12654 !! options
12655 comment
12656 !! input
12657 I like the [[Main Page|best page]]s a lot
12658 !! result
12659 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
12660 !!end
12661
12662 !! test
12663 Edit comment with section link (non-local, eg in history list)
12664 !! options
12665 comment title=[[Main Page]]
12666 !! input
12667 /* External links */ removed bogus entries
12668 !! result
12669 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
12670 !!end
12671
12672 !! test
12673 Edit comment with section link and text before it (non-local, eg in history list)
12674 !! options
12675 comment title=[[Main Page]]
12676 !! input
12677 pre-comment text /* External links */ removed bogus entries
12678 !! result
12679 pre-comment text - <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
12680 !!end
12681
12682 !! test
12683 Edit comment with section link (local, eg in diff view)
12684 !! options
12685 comment local title=[[Main Page]]
12686 !! input
12687 /* External links */ removed bogus entries
12688 !! result
12689 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
12690 !!end
12691
12692 !! test
12693 Edit comment with subpage link (bug 14080)
12694 !! options
12695 comment
12696 subpage
12697 title=[[Subpage test]]
12698 !! input
12699 Poked at a [[/subpage]] here...
12700 !! result
12701 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
12702 !!end
12703
12704 !! test
12705 Edit comment with subpage link and link text (bug 14080)
12706 !! options
12707 comment
12708 subpage
12709 title=[[Subpage test]]
12710 !! input
12711 Poked at a [[/subpage|neat little page]] here...
12712 !! result
12713 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
12714 !!end
12715
12716 !! test
12717 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
12718 !! options
12719 comment
12720 title=[[Subpage test]]
12721 !! input
12722 Poked at a [[/subpage]] here...
12723 !! result
12724 Poked at a <a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a> here...
12725 !!end
12726
12727 !! test
12728 Edit comment with bare anchor link (local, as on diff)
12729 !! options
12730 comment
12731 local
12732 title=[[Main Page]]
12733 !!input
12734 [[#section]]
12735 !! result
12736 <a href="#section">#section</a>
12737 !! end
12738
12739 !! test
12740 Edit comment with bare anchor link (non-local, as on history)
12741 !! options
12742 comment
12743 title=[[Main Page]]
12744 !!input
12745 [[#section]]
12746 !! result
12747 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
12748 !! end
12749
12750 !! test
12751 Anchor starting with underscore
12752 !!input
12753 [[#_ref|One]]
12754 !! result
12755 <p><a href="#_ref">One</a>
12756 </p>
12757 !! end
12758
12759 !! test
12760 Id starting with underscore
12761 !!input
12762 <div id="_ref"></div>
12763 !! result
12764 <div id="_ref"></div>
12765
12766 !! end
12767
12768 !! test
12769 Space normalisation on autocomment (bug 22784)
12770 !! options
12771 comment
12772 title=[[Main Page]]
12773 !!input
12774 /* __hello__world__ */
12775 !! result
12776 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
12777 !! end
12778
12779 !! test
12780 percent-encoding and + signs in comments (Bug 26410)
12781 !! options
12782 comment
12783 !!input
12784 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
12785 !! result
12786 <a href="/index.php?title=ABC3D%25_%2B%2B&amp;action=edit&amp;redlink=1" class="new" title="ABC3D% ++ (page does not exist)">ABC3D% ++</a> <a href="/index.php?title=ABC3D%25_%2B%2B&amp;action=edit&amp;redlink=1" class="new" title="ABC3D% ++ (page does not exist)">+%20</a>
12787 !! end
12788
12789 !! test
12790 Bad images - basic functionality
12791 !! options
12792 disabled
12793 !! input
12794 [[File:Bad.jpg]]
12795 !! result
12796 !! end
12797
12798 !! test
12799 Bad images - bug 16039: text after bad image disappears
12800 !! options
12801 disabled
12802 !! input
12803 Foo bar
12804 [[File:Bad.jpg]]
12805 Bar foo
12806 !! result
12807 <p>Foo bar
12808 </p><p>Bar foo
12809 </p>
12810 !! end
12811
12812 !! test
12813 Verify that displaytitle works (bug #22501) no displaytitle
12814 !! options
12815 showtitle
12816 !! config
12817 wgAllowDisplayTitle=true
12818 wgRestrictDisplayTitle=false
12819 !! input
12820 this is not the the title
12821 !! result
12822 Parser test
12823 <p>this is not the the title
12824 </p>
12825 !! end
12826
12827 !! test
12828 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
12829 !! options
12830 showtitle
12831 title=[[Screen]]
12832 !! config
12833 wgAllowDisplayTitle=true
12834 wgRestrictDisplayTitle=false
12835 !! input
12836 this is not the the title
12837 {{DISPLAYTITLE:whatever}}
12838 !! result
12839 whatever
12840 <p>this is not the the title
12841 </p>
12842 !! end
12843
12844 !! test
12845 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
12846 !! options
12847 showtitle
12848 title=[[Screen]]
12849 !! config
12850 wgAllowDisplayTitle=true
12851 wgRestrictDisplayTitle=true
12852 !! input
12853 this is not the the title
12854 {{DISPLAYTITLE:whatever}}
12855 !! result
12856 Screen
12857 <p>this is not the the title
12858 </p>
12859 !! end
12860
12861 !! test
12862 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
12863 !! options
12864 showtitle
12865 title=[[Screen]]
12866 !! config
12867 wgAllowDisplayTitle=true
12868 wgRestrictDisplayTitle=true
12869 !! input
12870 this is not the the title
12871 {{DISPLAYTITLE:screen}}
12872 !! result
12873 screen
12874 <p>this is not the the title
12875 </p>
12876 !! end
12877
12878 !! test
12879 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
12880 !! options
12881 showtitle
12882 title=[[Screen]]
12883 !! config
12884 wgAllowDisplayTitle=false
12885 !! input
12886 this is not the the title
12887 {{DISPLAYTITLE:screen}}
12888 !! result
12889 Screen
12890 <p>this is not the the title
12891 <a href="/index.php?title=Template:DISPLAYTITLE:screen&amp;action=edit&amp;redlink=1" class="new" title="Template:DISPLAYTITLE:screen (page does not exist)">Template:DISPLAYTITLE:screen</a>
12892 </p>
12893 !! end
12894
12895 !! test
12896 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
12897 !! options
12898 showtitle
12899 title=[[Screen]]
12900 !! config
12901 wgAllowDisplayTitle=false
12902 !! input
12903 this is not the the title
12904 !! result
12905 Screen
12906 <p>this is not the the title
12907 </p>
12908 !! end
12909
12910 !! test
12911 preload: check <noinclude> and <includeonly>
12912 !! options
12913 preload
12914 !! input
12915 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
12916 !! result
12917 Hello kind world.
12918 !! end
12919
12920 !! test
12921 preload: check <onlyinclude>
12922 !! options
12923 preload
12924 !! input
12925 Goodbye <onlyinclude>Hello world</onlyinclude>
12926 !! result
12927 Hello world
12928 !! end
12929
12930 !! test
12931 preload: can pass tags through if we want to
12932 !! options
12933 preload
12934 !! input
12935 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
12936 !! result
12937 <includeonly>Hello world</includeonly>
12938 !! end
12939
12940 !! test
12941 preload: check that it doesn't try to do tricks
12942 !! options
12943 preload
12944 !! input
12945 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
12946 !! result
12947 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
12948 !! end
12949
12950 !! test
12951 Play a bit with r67090 and bug 3158
12952 !! options
12953 disabled
12954 !! input
12955 <div style="width:50% !important">&nbsp;</div>
12956 <div style="width:50%&nbsp;!important">&nbsp;</div>
12957 <div style="width:50%&#160;!important">&nbsp;</div>
12958 <div style="border : solid;">&nbsp;</div>
12959 !! result
12960 <div style="width:50% !important">&nbsp;</div>
12961 <div style="width:50% !important">&nbsp;</div>
12962 <div style="width:50% !important">&nbsp;</div>
12963 <div style="border&#160;: solid;">&nbsp;</div>
12964
12965 !! end
12966
12967 !! test
12968 HTML5 data attributes
12969 !! input
12970 <span data-foo="bar">Baz</span>
12971 <p data-abc-def_hij="">Quuz</p>
12972 !! result
12973 <p><span data-foo="bar">Baz</span>
12974 </p>
12975 <p data-abc-def_hij="">Quuz</p>
12976
12977 !! end
12978
12979 !! test
12980 percent-encoding and + signs in internal links (Bug 26410)
12981 !! input
12982 [[User:+%]] [[Page+title%]]
12983 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
12984 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
12985 [[%33%45]] [[%33%45+]]
12986 !! result
12987 <p><a href="/index.php?title=User:%2B%25&amp;action=edit&amp;redlink=1" class="new" title="User:+% (page does not exist)">User:+%</a> <a href="/index.php?title=Page%2Btitle%25&amp;action=edit&amp;redlink=1" class="new" title="Page+title% (page does not exist)">Page+title%</a>
12988 <a href="/index.php?title=%25%2B&amp;action=edit&amp;redlink=1" class="new" title="%+ (page does not exist)">%+</a> <a href="/index.php?title=%25%2B&amp;action=edit&amp;redlink=1" class="new" title="%+ (page does not exist)">%20</a> <a href="/index.php?title=%25%2B&amp;action=edit&amp;redlink=1" class="new" title="%+ (page does not exist)">%+ </a> <a href="/index.php?title=%25%2Br&amp;action=edit&amp;redlink=1" class="new" title="%+r (page does not exist)">%+r</a>
12989 <a href="/index.php?title=%25&amp;action=edit&amp;redlink=1" class="new" title="% (page does not exist)">%</a> <a href="/index.php?title=%2B&amp;action=edit&amp;redlink=1" class="new" title="+ (page does not exist)">+</a> <a href="/index.php?title=Special:Upload&amp;wpDestFile=%25%2Babc9" class="new" title="File:%+abc9">bar</a>
12990 <a href="/index.php?title=3E&amp;action=edit&amp;redlink=1" class="new" title="3E (page does not exist)">3E</a> <a href="/index.php?title=3E%2B&amp;action=edit&amp;redlink=1" class="new" title="3E+ (page does not exist)">3E+</a>
12991 </p>
12992 !! end
12993
12994 !! test
12995 Special characters in embedded file links (bug 27679)
12996 !! input
12997 [[File:Contains & ampersand.jpg]]
12998 [[File:Does not exist.jpg|Title with & ampersand]]
12999 !! result
13000 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Contains_%26_ampersand.jpg" class="new" title="File:Contains &amp; ampersand.jpg">File:Contains &amp; ampersand.jpg</a>
13001 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Does_not_exist.jpg" class="new" title="File:Does not exist.jpg">Title with &amp; ampersand</a>
13002 </p>
13003 !! end
13004
13005
13006 !! test
13007 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
13008 !! input
13009 Text&apos;s been normalized?
13010 !! result
13011 <p>Text&#39;s been normalized?
13012 </p>
13013 !! end
13014
13015 !! test
13016 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
13017 !! input
13018 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
13019 !! result
13020 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
13021 </p>
13022 !! end
13023
13024 !! test
13025 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
13026 !! input
13027 [http://www.example.org/ ideograms]
13028 !! result
13029 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
13030 </p>
13031 !! end
13032
13033 !! test
13034 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
13035 !! input
13036 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
13037 !! result
13038 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
13039 </p>
13040 !! end
13041
13042 !! article
13043 Mediawiki:loop1
13044 !! text
13045 {{Identical|A}}
13046 !! endarticle
13047
13048 !! article
13049 Mediawiki:loop2
13050 !! text
13051 {{Identical|B}}
13052 !! endarticle
13053
13054 !! article
13055 Template:Identical
13056 !! text
13057 {{int:loop1}}
13058 {{int:loop2}}
13059 !! endarticle
13060
13061 !! test
13062 Bug 31098 Template which includes system messages which includes the template
13063 !! input
13064 {{Identical}}
13065 !! result
13066 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
13067 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
13068 </p>
13069 !! end
13070
13071 !! test
13072 Bug31490 Turkish: ucfirst 'blah'
13073 !! options
13074 language=tr
13075 !! input
13076 {{ucfirst:blah}}
13077 !! result
13078 <p>Blah
13079 </p>
13080 !! end
13081
13082 !! test
13083 Bug31490 Turkish: ucfirst 'ix'
13084 !! options
13085 language=tr
13086 !! input
13087 {{ucfirst:ix}}
13088 !! result
13089 <p>İx
13090 </p>
13091 !! end
13092
13093 !! test
13094 Bug31490 Turkish: lcfirst 'BLAH'
13095 !! options
13096 language=tr
13097 !! input
13098 {{lcfirst:BLAH}}
13099 !! result
13100 <p>bLAH
13101 </p>
13102 !! end
13103
13104 !! test
13105 Bug31490 Turkish: ucfırst (with a dotless i)
13106 !! options
13107 language=tr
13108 !! input
13109 {{ucfırst:blah}}
13110 !! result
13111 <p><a href="/index.php?title=%C5%9Eablon:Ucf%C4%B1rst:blah&amp;action=edit&amp;redlink=1" class="new" title="Şablon:Ucfırst:blah (sayfa mevcut değil)">Şablon:Ucfırst:blah</a>
13112 </p>
13113 !! end
13114
13115 !! test
13116 Bug31490 ucfırst (with a dotless i) with English language
13117 !! options
13118 language=en
13119 !! input
13120 {{ucfırst:blah}}
13121 !! result
13122 <p><a href="/index.php?title=Template:Ucf%C4%B1rst:blah&amp;action=edit&amp;redlink=1" class="new" title="Template:Ucfırst:blah (page does not exist)">Template:Ucfırst:blah</a>
13123 </p>
13124 !! end
13125
13126 !! test
13127 Bug 26375: TOC with italics
13128 !! options
13129 title=[[Main Page]]
13130 !! input
13131 __TOC__
13132 == ''Lost'' episodes ==
13133 !! result
13134 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13135 <ul>
13136 <li class="toclevel-1 tocsection-1"><a href="#Lost_episodes"><span class="tocnumber">1</span> <span class="toctext"><i>Lost</i> episodes</span></a></li>
13137 </ul>
13138 </td></tr></table>
13139 <h2><span class="editsection">[<a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Lost episodes">edit</a>]</span> <span class="mw-headline" id="Lost_episodes"><i>Lost</i> episodes</span></h2>
13140
13141 !! end
13142
13143 !! test
13144 Bug 26375: TOC with bold
13145 !! options
13146 title=[[Main Page]]
13147 !! input
13148 __TOC__
13149 == '''should be bold''' then normal text ==
13150 !! result
13151 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13152 <ul>
13153 <li class="toclevel-1 tocsection-1"><a href="#should_be_bold_then_normal_text"><span class="tocnumber">1</span> <span class="toctext"><b>should be bold</b> then normal text</span></a></li>
13154 </ul>
13155 </td></tr></table>
13156 <h2><span class="editsection">[<a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: should be bold then normal text">edit</a>]</span> <span class="mw-headline" id="should_be_bold_then_normal_text"><b>should be bold</b> then normal text</span></h2>
13157
13158 !! end
13159
13160 !! test
13161 Bug 33845: Headings become cursive in TOC when they contain an image
13162 !! options
13163 title=[[Main Page]]
13164 !! input
13165 __TOC__
13166 == Image [[Image:foobar.jpg]] ==
13167 !! result
13168 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13169 <ul>
13170 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
13171 </ul>
13172 </td></tr></table>
13173 <h2><span class="editsection">[<a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Image">edit</a>]</span> <span class="mw-headline" id="Image">Image <a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></span></h2>
13174
13175 !! end
13176
13177 !! test
13178 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
13179 !! options
13180 title=[[Main Page]]
13181 !! input
13182 __TOC__
13183 == <blockquote>Quote</blockquote> ==
13184 !! result
13185 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13186 <ul>
13187 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
13188 </ul>
13189 </td></tr></table>
13190 <h2><span class="editsection">[<a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Quote">edit</a>]</span> <span class="mw-headline" id="Quote"><blockquote>Quote</blockquote></span></h2>
13191
13192 !! end
13193
13194 !! test
13195 Unclosed tags in TOC
13196 !! options
13197 title=[[Main Page]]
13198 !! input
13199 __TOC__
13200 == Proof: 2 < 3 ==
13201 <small>Hanc marginis exiguitas non caperet.</small>
13202 QED
13203 !! result
13204 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13205 <ul>
13206 <li class="toclevel-1 tocsection-1"><a href="#Proof:_2_.3C_3"><span class="tocnumber">1</span> <span class="toctext">Proof: 2 &lt; 3</span></a></li>
13207 </ul>
13208 </td></tr></table>
13209 <h2><span class="editsection">[<a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Proof: 2 &lt; 3">edit</a>]</span> <span class="mw-headline" id="Proof:_2_.3C_3">Proof: 2 &lt; 3</span></h2>
13210 <p><small>Hanc marginis exiguitas non caperet.</small>
13211 QED
13212 </p>
13213 !! end
13214
13215 !! test
13216 Multiple tags in TOC
13217 !! input
13218 __TOC__
13219 == <i>Foo</i> <b>Bar</b> ==
13220
13221 == <i>Foo</i> <blockquote>Bar</blockquote> ==
13222 !! result
13223 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13224 <ul>
13225 <li class="toclevel-1 tocsection-1"><a href="#Foo_Bar"><span class="tocnumber">1</span> <span class="toctext"><i>Foo</i> <b>Bar</b></span></a></li>
13226 <li class="toclevel-1 tocsection-2"><a href="#Foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext"><i>Foo</i> Bar</span></a></li>
13227 </ul>
13228 </td></tr></table>
13229 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Foo Bar">edit</a>]</span> <span class="mw-headline" id="Foo_Bar"><i>Foo</i> <b>Bar</b></span></h2>
13230 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Foo Bar">edit</a>]</span> <span class="mw-headline" id="Foo_Bar_2"><i>Foo</i> <blockquote>Bar</blockquote></span></h2>
13231
13232 !! end
13233
13234 !! test
13235 Tags with parameters in TOC
13236 !! input
13237 __TOC__
13238 == <sup class="in-h2">Hello</sup> ==
13239
13240 == <sup class="a > b">Evilbye</sup> ==
13241 !! result
13242 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13243 <ul>
13244 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
13245 <li class="toclevel-1 tocsection-2"><a href="#b.22.3EEvilbye"><span class="tocnumber">2</span> <span class="toctext"><sup> b"&gt;Evilbye</sup></span></a></li>
13246 </ul>
13247 </td></tr></table>
13248 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Hello">edit</a>]</span> <span class="mw-headline" id="Hello"><sup class="in-h2">Hello</sup></span></h2>
13249 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: b&quot;>Evilbye">edit</a>]</span> <span class="mw-headline" id="b.22.3EEvilbye"><sup> b"&gt;Evilbye</sup></span></h2>
13250
13251 !! end
13252
13253 !! test
13254 span tags with directionality in TOC
13255 !! input
13256 __TOC__
13257 == <span dir="ltr">C++</span> ==
13258
13259 == <span dir="rtl">זבנג!</span> ==
13260
13261 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
13262
13263 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
13264
13265 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
13266 !! result
13267 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13268 <ul>
13269 <li class="toclevel-1 tocsection-1"><a href="#C.2B.2B"><span class="tocnumber">1</span> <span class="toctext"><span dir="ltr">C++</span></span></a></li>
13270 <li class="toclevel-1 tocsection-2"><a href="#.D7.96.D7.91.D7.A0.D7.92.21"><span class="tocnumber">2</span> <span class="toctext"><span dir="rtl">זבנג!</span></span></a></li>
13271 <li class="toclevel-1 tocsection-3"><a href="#The_attributes_on_these_span_tags_must_be_deleted_from_the_TOC"><span class="tocnumber">3</span> <span class="toctext"><span>The attributes on these span tags must be deleted from the TOC</span></span></a></li>
13272 <li class="toclevel-1 tocsection-4"><a href="#All_attributes_on_these_span_tags_must_be_deleted_from_the_TOC"><span class="tocnumber">4</span> <span class="toctext"><span>All attributes on these span tags must be deleted from the TOC</span></span></a></li>
13273 <li class="toclevel-1 tocsection-5"><a href="#Attributes_after_dir_on_these_span_tags_must_be_deleted_from_the_TOC"><span class="tocnumber">5</span> <span class="toctext"><span dir="ltr">Attributes after dir on these span tags must be deleted from the TOC</span></span></a></li>
13274 </ul>
13275 </td></tr></table>
13276 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: C++">edit</a>]</span> <span class="mw-headline" id="C.2B.2B"><span dir="ltr">C++</span></span></h2>
13277 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: זבנג!">edit</a>]</span> <span class="mw-headline" id=".D7.96.D7.91.D7.A0.D7.92.21"><span dir="rtl">זבנג!</span></span></h2>
13278 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: The attributes on these span tags must be deleted from the TOC">edit</a>]</span> <span class="mw-headline" id="The_attributes_on_these_span_tags_must_be_deleted_from_the_TOC"><span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span></span></h2>
13279 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: All attributes on these span tags must be deleted from the TOC">edit</a>]</span> <span class="mw-headline" id="All_attributes_on_these_span_tags_must_be_deleted_from_the_TOC"><span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span></span></h2>
13280 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Attributes after dir on these span tags must be deleted from the TOC">edit</a>]</span> <span class="mw-headline" id="Attributes_after_dir_on_these_span_tags_must_be_deleted_from_the_TOC"><span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span></span></h2>
13281
13282 !! end
13283
13284 !! article
13285 MediaWiki:Bug32057
13286 !! text
13287 == {{int:headline_sample}} ==
13288 !! endarticle
13289
13290 !! test
13291 Bug 32057: Title needed when expanding <h> nodes.
13292 !! options
13293 title=[[Main Page]]
13294 !! input
13295 {{int:Bug32057}}
13296 !! result
13297 <h2><span class="editsection">[<a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Headline text">edit</a>]</span> <span class="mw-headline" id="Headline_text">Headline text</span></h2>
13298
13299 !! end
13300
13301 !! test
13302 Strip marker in urlencode
13303 !! input
13304 {{urlencode:x<nowiki/>y}}
13305 {{urlencode:x<nowiki/>y|wiki}}
13306 {{urlencode:x<nowiki/>y|path}}
13307 !! result
13308 <p>xy
13309 xy
13310 xy
13311 </p>
13312 !! end
13313
13314 !! test
13315 Strip marker in lc
13316 !! input
13317 {{lc:x<nowiki/>y}}
13318 !! result
13319 <p>xy
13320 </p>
13321 !! end
13322
13323 !! test
13324 Strip marker in uc
13325 !! input
13326 {{uc:x<nowiki/>y}}
13327 !! result
13328 <p>XY
13329 </p>
13330 !! end
13331
13332 !! test
13333 Strip marker in formatNum
13334 !! input
13335 {{formatnum:1<nowiki/>2}}
13336 {{formatnum:1<nowiki/>2|R}}
13337 !! result
13338 <p>12
13339 12
13340 </p>
13341 !! end
13342
13343 !! test
13344 Check noCommafy in formatNum
13345 !! options
13346 language=be-tarask
13347 !! input
13348 {{formatnum:123456.78}}
13349 {{formatnum:123456.78|NOSEP}}
13350 !! result
13351 <p>123 456,78
13352 123456.78
13353 </p>
13354 !! end
13355
13356 !! test
13357 Strip marker in grammar
13358 !! options
13359 language=fi
13360 !! input
13361 {{grammar:elative|foo<nowiki/>bar}}
13362 !! result
13363 <p>foobarista
13364 </p>
13365 !! end
13366
13367 !! test
13368 Strip marker in padleft
13369 !! input
13370 {{padleft:|2|x<nowiki/>y}}
13371 !! result
13372 <p>xy
13373 </p>
13374 !! end
13375
13376 !! test
13377 Strip marker in padright
13378 !! input
13379 {{padright:|2|x<nowiki/>y}}
13380 !! result
13381 <p>xy
13382 </p>
13383 !! end
13384
13385 !! test
13386 Strip marker in anchorencode
13387 !! input
13388 {{anchorencode:x<nowiki/>y}}
13389 !! result
13390 <p>xy
13391 </p>
13392 !! end
13393
13394 !! test
13395 nowiki inside link inside heading (bug 18295)
13396 !! input
13397 ==[[foo|x<nowiki>y</nowiki>z]]==
13398 !! result
13399 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: xyz">edit</a>]</span> <span class="mw-headline" id="xyz"><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">xyz</a></span></h2>
13400
13401 !! end
13402
13403 !! test
13404 new support for bdi element (bug 31817)
13405 !! input
13406 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
13407 !! result
13408 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
13409
13410 !!end
13411
13412 !! test
13413 Ignore pipe between table row attributes
13414 !! input
13415 {|
13416 | quux
13417 |- id=foo | style='color: red'
13418 | bar
13419 |}
13420 !! result
13421 <table>
13422 <tr>
13423 <td> quux
13424 </td></tr>
13425 <tr id="foo" style="color: red">
13426 <td> bar
13427 </td></tr></table>
13428
13429 !! end
13430
13431 !!test
13432 Gallery override link with WikiLink (bug 34852)
13433 !! input
13434 <gallery>
13435 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
13436 </gallery>
13437 !! result
13438 <ul class="gallery">
13439 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13440 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/InterWikiLink"><img alt="galleryalt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
13441 <div class="gallerytext">
13442 <p>caption
13443 </p>
13444 </div>
13445 </div></li>
13446 </ul>
13447
13448 !! end
13449
13450 !!test
13451 Gallery override link with absolute external link (bug 34852)
13452 !! input
13453 <gallery>
13454 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
13455 </gallery>
13456 !! result
13457 <ul class="gallery">
13458 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13459 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="http://www.example.org"><img alt="galleryalt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
13460 <div class="gallerytext">
13461 <p>caption
13462 </p>
13463 </div>
13464 </div></li>
13465 </ul>
13466
13467 !! end
13468
13469 !!test
13470 Gallery override link with malicious javascript (bug 34852)
13471 !! input
13472 <gallery>
13473 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
13474 </gallery>
13475 !! result
13476 <ul class="gallery">
13477 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13478 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/%22_onclick%3D%22alert(%27malicious_javascript_code!%27);"><img alt="galleryalt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
13479 <div class="gallerytext">
13480 <p>caption
13481 </p>
13482 </div>
13483 </div></li>
13484 </ul>
13485
13486 !! end
13487
13488 !!test
13489 Gallery with invalid title as link (bug 43964)
13490 !! input
13491 <gallery>
13492 File:foobar.jpg|link=<
13493 </gallery>
13494 !! result
13495 <ul class="gallery">
13496 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13497 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
13498 <div class="gallerytext">
13499 </div>
13500 </div></li>
13501 </ul>
13502
13503 !! end
13504
13505 !!test
13506 Language parser function
13507 !! input
13508 {{#language:ar}}
13509 !! result
13510 <p>العربية
13511 </p>
13512 !! end
13513
13514 !!test
13515 Padleft and padright as substr
13516 !! input
13517 {{padleft:|3|abcde}}
13518 {{padright:|3|abcde}}
13519 !! result
13520 <p>abc
13521 abc
13522 </p>
13523 !! end
13524
13525 !!test
13526 Bug 34939 - Case insensitive link parsing ([HttP://])
13527 !! input
13528 [HttP://MediaWiki.Org/]
13529 !! result
13530 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
13531 </p>
13532 !! end
13533
13534 !!test
13535 Bug 34939 - Case insensitive link parsing ([HttP:// title])
13536 !! input
13537 [HttP://MediaWiki.Org/ MediaWiki]
13538 !! result
13539 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
13540 </p>
13541 !! end
13542
13543 !!test
13544 Bug 34939 - Case insensitive link parsing (HttP://)
13545 !! input
13546 HttP://MediaWiki.Org/
13547 !! result
13548 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
13549 </p>
13550 !! end
13551
13552 ###
13553 ### Parsoids-specific tests
13554 ### Parsoid-PHP parser incompatibilities
13555 ###
13556 !!test
13557 1. SOL-sensitive wikitext tokens as template-args
13558 !!options
13559 disabled
13560 !!input
13561 {{echo|*a}}
13562 {{echo|#a}}
13563 {{echo|:a}}
13564 !!result
13565 <p>*a
13566 #a
13567 :a
13568 </p>
13569 !!end
13570
13571 #### The following section of tests are primarily to test
13572 #### wikitext escaping capabilities of Parsoid.
13573 #### A lot of the tests are disabled for the PHP parser either
13574 #### because of minor newline diffs or other reasons.
13575 #### As Parsoid serializer can handle newlines and other HTML
13576 #### more robustly, some of these tests might get reenabled
13577 #### for the PHP parser.
13578
13579 #### --------------- Headings ---------------
13580 #### 0. Unnested
13581 #### 1. Nested inside html <h1>=foo=</h1>
13582 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
13583 #### 3. Nested inside html with wikitext split by html tags
13584 #### 4. No escape needed
13585 #### 5. Empty headings <h1></h1>
13586 #### 6. Heading chars in SOL context
13587 #### ----------------------------------------
13588 !! test
13589 Headings: 0. Unnested
13590 !! input
13591 <nowiki>=foo=</nowiki>
13592
13593 <nowiki>=foo</nowiki>''a''=
13594 !! result
13595 <p>=foo=
13596 </p><p>=foo<i>a</i>=
13597 </p>
13598 !!end
13599
13600 !! test
13601 Headings: 1. Nested inside html
13602 !! options
13603 disabled
13604 !! input
13605 =<nowiki>=foo=</nowiki>=
13606 ==<nowiki>=foo=</nowiki>==
13607 ===<nowiki>=foo=</nowiki>===
13608 ====<nowiki>=foo=</nowiki>====
13609 =====<nowiki>=foo=</nowiki>=====
13610 ======<nowiki>=foo=</nowiki>======
13611 !! result
13612 <h1>=foo=</h1>
13613 <h2>=foo=</h2>
13614 <h3>=foo=</h3>
13615 <h4>=foo=</h4>
13616 <h5>=foo=</h5>
13617 <h6>=foo=</h6>
13618 !!end
13619
13620 !! test
13621 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
13622 !! options
13623 disabled
13624 !! input
13625 =foo=
13626 <nowiki>*bar</nowiki>
13627 =foo=
13628 =bar
13629 =foo=
13630 <nowiki>=bar=</nowiki>
13631 !! result
13632 <h1>foo</h1>*bar
13633 <h1>foo</h1>=bar
13634 <h1>foo</h1>=bar=
13635 !!end
13636
13637 !! test
13638 Headings: 3. Nested inside html with wikitext split by html tags
13639 !! options
13640 disabled
13641 !! input
13642 =<nowiki>=</nowiki>'''bold'''foo==
13643 !! result
13644 <h1>=<b>bold</b>foo=</h1>
13645 !!end
13646
13647 !! test
13648 Headings: 4. No escaping needed (testing just h1 and h2)
13649 !! options
13650 disabled
13651 !! input
13652 ==foo=
13653 =foo==
13654 ===foo==
13655 ==foo===
13656 =''=''foo==
13657 ===
13658 !! result
13659 <h1>=foo</h1>
13660 <h1>foo=</h1>
13661 <h2>=foo</h2>
13662 <h2>foo=</h2>
13663 <h1><i>=</i>foo=</h1>
13664 <h1>=</h1>
13665 !!end
13666
13667 !! test
13668 Headings: 5. Empty headings
13669 !! options
13670 disabled
13671 !! input
13672 =<nowiki></nowiki>=
13673 ==<nowiki></nowiki>==
13674 ===<nowiki></nowiki>===
13675 ====<nowiki></nowiki>====
13676 =====<nowiki></nowiki>=====
13677 ======<nowiki></nowiki>======
13678 !! result
13679 <h1></h1>
13680 <h2></h2>
13681 <h3></h3>
13682 <h4></h4>
13683 <h5></h5>
13684 <h6></h6>
13685 !!end
13686
13687 !! test
13688 Headings: 6. Heading chars in SOL context
13689 !! options
13690 disabled
13691 !! input
13692 <!--cmt--><nowiki>=h1=</nowiki>
13693 !! result
13694 <p><!--cmt-->=h1=
13695 </p>
13696 !!end
13697
13698 #### --------------- Lists ---------------
13699 #### 0. Outside nests (*foo, etc.)
13700 #### 1. Nested inside html <ul><li>*foo</li></ul>
13701 #### 2. Inside definition lists
13702 #### 3. Only bullets at start should be escaped
13703 #### 4. No escapes needed
13704 #### 5. No unnecessary escapes
13705 #### 6. Escape bullets in SOL position
13706 #### 7. Escape bullets in a multi-line context
13707 #### ----------------------------------------
13708
13709 !! test
13710 Lists: 0. Outside nests
13711 !! input
13712 <nowiki>*foo</nowiki>
13713
13714 <nowiki>#foo</nowiki>
13715 !! result
13716 <p>*foo
13717 </p><p>#foo
13718 </p>
13719 !!end
13720
13721 !! test
13722 Lists: 1. Nested inside html
13723 !! input
13724 *<nowiki>*foo</nowiki>
13725
13726 *<nowiki>#foo</nowiki>
13727
13728 *<nowiki>:foo</nowiki>
13729
13730 *<nowiki>;foo</nowiki>
13731
13732 #<nowiki>*foo</nowiki>
13733
13734 #<nowiki>#foo</nowiki>
13735
13736 #<nowiki>:foo</nowiki>
13737
13738 #<nowiki>;foo</nowiki>
13739 !! result
13740 <ul><li>*foo
13741 </li></ul>
13742 <ul><li>#foo
13743 </li></ul>
13744 <ul><li>:foo
13745 </li></ul>
13746 <ul><li>;foo
13747 </li></ul>
13748 <ol><li>*foo
13749 </li></ol>
13750 <ol><li>#foo
13751 </li></ol>
13752 <ol><li>:foo
13753 </li></ol>
13754 <ol><li>;foo
13755 </li></ol>
13756
13757 !!end
13758
13759 !! test
13760 Lists: 2. Inside definition lists
13761 !! input
13762 ;<nowiki>;foo</nowiki>
13763
13764 ;<nowiki>:foo</nowiki>
13765
13766 ;<nowiki>:foo</nowiki>
13767 :bar
13768
13769 :<nowiki>:foo</nowiki>
13770 !! result
13771 <dl><dt>;foo
13772 </dt></dl>
13773 <dl><dt>:foo
13774 </dt></dl>
13775 <dl><dt>:foo
13776 </dt><dd>bar
13777 </dd></dl>
13778 <dl><dd>:foo
13779 </dd></dl>
13780
13781 !!end
13782
13783 !! test
13784 Lists: 3. Only bullets at start of text should be escaped
13785 !! input
13786 *<nowiki>*foo*bar</nowiki>
13787
13788 *<nowiki>*foo</nowiki>''it''*bar
13789 !! result
13790 <ul><li>*foo*bar
13791 </li></ul>
13792 <ul><li>*foo<i>it</i>*bar
13793 </li></ul>
13794
13795 !!end
13796
13797 !! test
13798 Lists: 4. No escapes needed
13799 !! options
13800 disabled
13801 !! input
13802 *foo*bar
13803
13804 *''foo''*bar
13805
13806 *[[Foo]]: bar
13807 !! result
13808 <ul><li>foo*bar
13809 </li></ul>
13810 <ul><li><i>foo</i>*bar
13811 </li></ul>
13812 <ul><li><a href="Foo" rel="mw:WikiLink">Foo</a>: bar
13813 </li></ul>
13814 !!end
13815
13816 !! test
13817 Lists: 5. No unnecessary escapes
13818 !! input
13819 * bar <span><nowiki>[[foo]]</nowiki></span>
13820
13821 *=bar <span><nowiki>[[foo]]</nowiki></span>
13822
13823 *[[bar <span><nowiki>[[foo]]</nowiki></span>
13824
13825 *<nowiki>]]bar </nowiki><span><nowiki>[[foo]]</nowiki></span>
13826
13827 *=bar <span>foo]]</span>=
13828 !! result
13829 <ul><li> bar <span>[[foo]]</span>
13830 </li></ul>
13831 <ul><li>=bar <span>[[foo]]</span>
13832 </li></ul>
13833 <ul><li>[[bar <span>[[foo]]</span>
13834 </li></ul>
13835 <ul><li>]]bar <span>[[foo]]</span>
13836 </li></ul>
13837 <ul><li>=bar <span>foo]]</span>=
13838 </li></ul>
13839
13840 !!end
13841
13842 !! test
13843 Lists: 6. Escape bullets in SOL position
13844 !! options
13845 disabled
13846 !! input
13847 <!--cmt--><nowiki>*foo</nowiki>
13848 !! result
13849 <p><!--cmt-->*foo
13850 </p>
13851 !!end
13852
13853 !! test
13854 Lists: 7. Escape bullets in a multi-line context
13855 !! input
13856 <nowiki>a
13857 *b</nowiki>
13858 !! result
13859 <p>a
13860 *b
13861 </p>
13862 !!end
13863
13864 #### --------------- HRs ---------------
13865 #### 1. Single line
13866 #### -----------------------------------
13867
13868 !! test
13869 HRs: 1. Single line
13870 !! options
13871 disabled
13872 !! input
13873 ----
13874 <nowiki>----</nowiki>
13875 ----
13876 <nowiki>=foo=</nowiki>
13877 ----
13878 <nowiki>*foo</nowiki>
13879 !! result
13880 <hr/>----
13881 <hr/>=foo=
13882 <hr/>*foo
13883 !! end
13884
13885 #### --------------- Tables ---------------
13886 #### 1a. Simple example
13887 #### 1b. No escaping needed (!foo)
13888 #### 1c. No escaping needed (|foo)
13889 #### 1d. No escaping needed (|}foo)
13890 ####
13891 #### 2a. Nested in td (<td>foo|bar</td>)
13892 #### 2b. Nested in td (<td>foo||bar</td>)
13893 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
13894 ####
13895 #### 3a. Nested in th (<th>foo!bar</th>)
13896 #### 3b. Nested in th (<th>foo!!bar</th>)
13897 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
13898 ####
13899 #### 4a. Escape -
13900 #### 4b. Escape +
13901 #### 4c. No escaping needed
13902 #### --------------------------------------
13903
13904 !! test
13905 Tables: 1a. Simple example
13906 !! input
13907 <nowiki>{|
13908 |}</nowiki>
13909 !! result
13910 <p>{|
13911 |}
13912 </p>
13913 !! end
13914
13915 !! test
13916 Tables: 1b. No escaping needed
13917 !! input
13918 !foo
13919 !! result
13920 <p>!foo
13921 </p>
13922 !! end
13923
13924 !! test
13925 Tables: 1c. No escaping needed
13926 !! input
13927 |foo
13928 !! result
13929 <p>|foo
13930 </p>
13931 !! end
13932
13933 !! test
13934 Tables: 1d. No escaping needed
13935 !! input
13936 |}foo
13937 !! result
13938 <p>|}foo
13939 </p>
13940 !! end
13941
13942 !! test
13943 Tables: 2a. Nested in td
13944 !! options
13945 disabled
13946 !! input
13947 {|
13948 |<nowiki>foo|bar</nowiki>
13949 |}
13950 !! result
13951 <table>
13952 <tr><td>foo|bar
13953 </td></tr></table>
13954
13955 !! end
13956
13957 !! test
13958 Tables: 2b. Nested in td
13959 !! options
13960 disabled
13961 !! input
13962 {|
13963 |<nowiki>foo||bar</nowiki>
13964 |''it''<nowiki>foo||bar</nowiki>
13965 |}
13966 !! result
13967 <table>
13968 <tr><td>foo||bar
13969 </td><td><i>it</i>foo||bar
13970 </td></tr></table>
13971
13972 !! end
13973
13974 !! test
13975 Tables: 2c. Nested in td -- no escaping needed
13976 !! options
13977 disabled
13978 !! input
13979 {|
13980 |foo!!bar
13981 |}
13982 !! result
13983 <table>
13984 <tr><td>foo!!bar
13985 </td></tr></table>
13986
13987 !! end
13988
13989 !! test
13990 Tables: 3a. Nested in th
13991 !! options
13992 disabled
13993 !! input
13994 {|
13995 !foo!bar
13996 |}
13997 !! result
13998 <table>
13999 <tr><th>foo!bar
14000 </th></tr></table>
14001
14002 !! end
14003
14004 !! test
14005 Tables: 3b. Nested in th
14006 !! options
14007 disabled
14008 !! input
14009 {|
14010 !<nowiki>foo!!bar</nowiki>
14011 |}
14012 !! result
14013 <table>
14014 <tr><th>foo!!bar
14015 </th></tr></table>
14016
14017 !! end
14018
14019 !! test
14020 Tables: 3c. Nested in th -- no escaping needed
14021 !! options
14022 disabled
14023 !! input
14024 {|
14025 !foo||bar
14026 |}
14027 !! result
14028 <table>
14029 <tr><th>foo||bar
14030 </th></tr></table>
14031
14032 !! end
14033
14034 !! test
14035 Tables: 4a. Escape -
14036 !! options
14037 disabled
14038 !! input
14039 {|
14040 |-
14041 !-bar
14042 |-
14043 |<nowiki>-bar</nowiki>
14044 |}
14045 !! result
14046 <table><tbody>
14047 <tr><th>-bar</th></tr>
14048 <tr><td>-bar</td></tr>
14049 </tbody></table>
14050 !! end
14051
14052 !! test
14053 Tables: 4b. Escape +
14054 !! options
14055 disabled
14056 !! input
14057 {|
14058 |-
14059 !+bar
14060 |-
14061 |<nowiki>+bar</nowiki>
14062 |}
14063 !! result
14064 <table><tbody>
14065 <tr><th>+bar</th></tr>
14066 <tr><td>+bar</td></tr>
14067 </tbody></table>
14068 !! end
14069
14070 !! test
14071 Tables: 4c. No escaping needed
14072 !! options
14073 disabled
14074 !! input
14075 {|
14076 |-
14077 |foo-bar
14078 |foo+bar
14079 |-
14080 |''foo''-bar
14081 |''foo''+bar
14082 |}
14083 !! result
14084 <table><tbody>
14085 <tr><td>foo-bar</td><td>foo+bar</td></tr>
14086 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
14087 </tbody></table>
14088 !! end
14089
14090 !! test
14091 Tables: 4d. No escaping needed
14092 !! input
14093 {|
14094 ||+1
14095 ||-2
14096 |}
14097 !! result
14098 <table>
14099 <tr>
14100 <td>+1
14101 </td>
14102 <td>-2
14103 </td></tr></table>
14104
14105 !! end
14106
14107 #### --------------- Links ---------------
14108 #### 1. Quote marks in link text
14109 #### 2. Wikilinks: Escapes needed
14110 #### 3. Wikilinks: No escapes needed
14111 #### 4. Extlinks: Escapes needed
14112 #### 5. Extlinks: No escapes needed
14113 #### --------------------------------------
14114 !! test
14115 Links 1. Quote marks in link text
14116 !! options
14117 disabled
14118 !! input
14119 [[Foo|<nowiki>Foo''boo''</nowiki>]]
14120 !! result
14121 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
14122 !! end
14123
14124 !! test
14125 Links 2. WikiLinks: Escapes needed
14126 !! options
14127 disabled
14128 !! input
14129 [[Foo|<nowiki>[Foobar]</nowiki>]]
14130 [[Foo|<nowiki>Foobar]</nowiki>]]
14131 [[Foo|<nowiki>x [Foobar] x</nowiki>]]
14132 [[Foo|<nowiki>x [http://google.com g] x</nowiki>]]
14133 [[Foo|<nowiki>[[Bar]]</nowiki>]]
14134 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
14135 [[Foo|<nowiki>|Bar</nowiki>]]
14136 !! result
14137 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
14138 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
14139 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
14140 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
14141 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
14142 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
14143 <a href="Foo" rel="mw:WikiLink">|Bar</a>
14144 !! end
14145
14146 !! test
14147 Links 3. WikiLinks: No escapes needed
14148 !! options
14149 disabled
14150 !! input
14151 [[Foo|[Foobar]]
14152 [[Foo|foo|bar]]
14153 !! result
14154 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
14155 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
14156 !! end
14157
14158 !! test
14159 Links 4. ExtLinks: Escapes needed
14160 !! options
14161 disabled
14162 !! input
14163 [http://google.com <nowiki>[google]</nowiki>]
14164 [http://google.com <nowiki>google]</nowiki>]
14165 !! result
14166 <a href="http://google.com" rel="mw:ExtLink">[google]</a>
14167 <a href="http://google.com" rel="mw:ExtLink">google]</a>
14168 !! end
14169
14170 !! test
14171 Links 5. ExtLinks: No escapes needed
14172 !! options
14173 disabled
14174 !! input
14175 [http://google.com [google]
14176 !! result
14177 <a href="http://google.com" rel="mw:ExtLink">[google</a>
14178 !! end
14179
14180 #### --------------- Quotes ---------------
14181 #### 1. Quotes inside <b> and <i>
14182 #### 2. Link fragments separated by <i> and <b> tags
14183 #### 3. Link fragments inside <i> and <b>
14184 #### --------------------------------------
14185 !! test
14186 1. Quotes inside <b> and <i>
14187 !! input
14188 ''<nowiki>'foo'</nowiki>''
14189 ''<nowiki>''foo''</nowiki>''
14190 ''<nowiki>'''foo'''</nowiki>''
14191 '''<nowiki>'foo'</nowiki>'''
14192 '''<nowiki>''foo''</nowiki>'''
14193 '''<nowiki>'''foo'''</nowiki>'''
14194 '''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz'''
14195 !! result
14196 <p><i>'foo'</i>
14197 <i>''foo''</i>
14198 <i>'''foo'''</i>
14199 <b>'foo'</b>
14200 <b>''foo''</b>
14201 <b>'''foo'''</b>
14202 <b>foo'<i>bar'</i>baz</b>
14203 </p>
14204 !! end
14205
14206 !! test
14207 2. Link fragments separated by <i> and <b> tags
14208 !! input
14209 [[''foo''<nowiki>hello]]</nowiki>
14210
14211 [['''foo'''<nowiki>hello]]</nowiki>
14212 !! result
14213 <p>[[<i>foo</i>hello]]
14214 </p><p>[[<b>foo</b>hello]]
14215 </p>
14216 !! end
14217
14218 !! test
14219 2. Link fragments inside <i> and <b>
14220 (FIXME: Escaping one or both of [[ and ]] is also acceptable --
14221 this is one of the shortcomings of this format)
14222 !! input
14223 ''[[foo''<nowiki>]]</nowiki>
14224
14225 '''[[foo'''<nowiki>]]</nowiki>
14226 !! result
14227 <p><i>[[foo</i>]]
14228 </p><p><b>[[foo</b>]]
14229 </p>
14230 !! end
14231
14232 #### --------------- Paragraphs ---------------
14233 #### 1. No unnecessary escapes
14234 #### --------------------------------------
14235
14236 !! test
14237 1. No unnecessary escapes
14238 !! input
14239 bar <span><nowiki>[[foo]]</nowiki></span>
14240
14241 =bar <span><nowiki>[[foo]]</nowiki></span>
14242
14243 [[bar <span><nowiki>[[foo]]</nowiki></span>
14244
14245 <nowiki>]]bar </nowiki><span><nowiki>[[foo]]</nowiki></span>
14246
14247 <nowiki>=bar </nowiki><span>foo]]</span>=
14248 !! result
14249 <p>bar <span>[[foo]]</span>
14250 </p><p>=bar <span>[[foo]]</span>
14251 </p><p>[[bar <span>[[foo]]</span>
14252 </p><p>]]bar <span>[[foo]]</span>
14253 </p><p>=bar <span>foo]]</span>=
14254 </p>
14255 !!end
14256
14257 #### --------------- PRE ------------------
14258 #### 1. Leading space in SOL context should be escaped
14259 #### --------------------------------------
14260 !! test
14261 1. Leading space in SOL context should be escaped
14262 !! options
14263 disabled
14264 !! input
14265 <nowiki> foo</nowiki>
14266 <!--cmt--><nowiki> foo</nowiki>
14267 !! result
14268 <p> foo
14269 <!--cmt--> foo
14270 </p>
14271 !! end
14272
14273 #### --------------- HTML tags ---------------
14274 #### 1. a tags
14275 #### 2. other tags
14276 #### 3. multi-line html tag
14277 #### --------------------------------------
14278 !! test
14279 1. a tags
14280 !! options
14281 disabled
14282 !! input
14283 <a href="http://google.com">google</a>
14284 !! result
14285 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
14286 !! end
14287
14288 !! test
14289 2. other tags
14290 !! input
14291 <nowiki><div>foo</div>
14292 <div style="color:red">foo</div></nowiki>
14293 !! result
14294 <p>&lt;div&gt;foo&lt;/div&gt;
14295 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
14296 </p>
14297 !! end
14298
14299 !! test
14300 3. multi-line html tag
14301 !! input
14302 <nowiki><div
14303 >foo</div
14304 ></nowiki>
14305 !! result
14306 <p>&lt;div
14307 &gt;foo&lt;/div
14308 &gt;
14309 </p>
14310 !! end
14311
14312 #### --------------- Others ---------------
14313 !! test
14314 Escaping nowikis
14315 !! input
14316 &lt;nowiki&gt;foo&lt;/nowiki&gt;
14317 !! result
14318 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
14319 </p>
14320 !! end
14321
14322 !! test
14323 Tag-like HTML structures are passed through as text
14324 !! input
14325 <x y>
14326
14327 <x.y>
14328
14329 <x-y>
14330
14331 1>2
14332
14333 x<y
14334
14335 a>b
14336
14337 1<d e>f
14338 !! result
14339 <p>&lt;x y&gt;
14340 </p><p>&lt;x.y&gt;
14341 </p><p>&lt;x-y&gt;
14342 </p><p>1&gt;2
14343 </p><p>x&lt;y
14344 </p><p>a&gt;b
14345 </p><p>1&lt;d e&gt;f
14346 </p>
14347 !! end
14348
14349
14350 # This fails in the PHP parser (see bug 40670,
14351 # https://bugzilla.wikimedia.org/show_bug.cgi?id=40670), so disabled for it.
14352 !! test
14353 Tag names followed by punctuation should not be recognized as tags
14354 !! options
14355 disabled
14356 !! input
14357 <s.ome> text
14358 !! result
14359 <p>&lt;s.ome&gt text
14360 </p>
14361 !! end
14362
14363 !! test
14364 HTML tag with necessary entities in attributes
14365 !! input
14366 <span title="&amp;amp;">foo</span>
14367 !! result
14368 <p><span title="&amp;amp;">foo</span>
14369 </p>
14370 !! end
14371
14372 !! test
14373 HTML tag with 'unnecessary' entity encoding in attributes
14374 !! input
14375 <span title="&amp;">foo</span>
14376 !! result
14377 <p><span title="&amp;">foo</span>
14378 </p>
14379 !! end
14380
14381 !! test
14382 HTML tag with broken attribute value quoting
14383 !! input
14384 <span title="Hello world>Foo</span>
14385 !! result
14386 <p><span>Foo</span>
14387 </p>
14388 !! end
14389
14390 !! test
14391 Parsoid-only: HTML tag with broken attribute value quoting
14392 !! options
14393 parsoid
14394 !! input
14395 <span title="Hello world>Foo</span>
14396 !! result
14397 <p><span title="Hello world">Foo</span>
14398 </p>
14399 !! end
14400
14401 !! test
14402 Table with broken attribute value quoting
14403 !! input
14404 {|
14405 | title="Hello world|Foo
14406 |}
14407 !! result
14408 <table>
14409 <tr>
14410 <td>Foo
14411 </td></tr></table>
14412
14413 !! end
14414
14415 !! test
14416 Table with broken attribute value quoting on consecutive lines
14417 !! input
14418 {|
14419 | title="Hello world|Foo
14420 | style="color:red|Bar
14421 |}
14422 !! result
14423 <table>
14424 <tr>
14425 <td>Foo
14426 </td>
14427 <td>Bar
14428 </td></tr></table>
14429
14430 !! end
14431
14432 !! test
14433 Parsoid-only: Table with broken attribute value quoting on consecutive lines
14434 !! options
14435 parsoid
14436 !! input
14437 {|
14438 | title="Hello world|Foo
14439 | style="color:red|Bar
14440 |}
14441 !! result
14442 <table>
14443 <tr>
14444 <td title="Hello world">Foo
14445 </td><td style="color: red">Bar
14446 </td></tr></table>
14447
14448 !! end
14449
14450 !! test
14451 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
14452 !! options
14453 parsoid
14454 !! input
14455 {{}}
14456 !! result
14457 {{}}
14458 !! end
14459
14460 !! test
14461 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
14462 !! options
14463 parsoid
14464 !! input
14465 }}{{
14466 !! result
14467 }}{{
14468 !! end
14469
14470 !!test
14471 Accept empty td cell attribute
14472 !!input
14473 {|
14474 | align="center" | foo || |
14475 |}
14476 !!result
14477 <table>
14478 <tr>
14479 <td align="center"> foo </td>
14480 <td>
14481 </td></tr></table>
14482
14483 !!end
14484
14485 !!test
14486 Non-empty attributes in th-cells
14487 !!input
14488 {|
14489 ! Foo !! style="color: red" | Bar
14490 |}
14491 !!result
14492 <table>
14493 <tr>
14494 <th> Foo </th>
14495 <th style="color: red"> Bar
14496 </th></tr></table>
14497
14498 !!end
14499
14500 !!test
14501 Accept empty attributes in th-cells
14502 !!input
14503 {|
14504 !| foo !!| bar
14505 |}
14506 !!result
14507 <table>
14508 <tr>
14509 <th> foo </th>
14510 <th> bar
14511 </th></tr></table>
14512
14513 !!end
14514
14515 !!test
14516 Empty table rows go away
14517 !!input
14518 {|
14519 | Hello
14520 | there
14521 |- class="foo"
14522 |-
14523 |}
14524 !! result
14525 <table>
14526 <tr>
14527 <td> Hello
14528 </td>
14529 <td> there
14530 </td></tr>
14531
14532 </table>
14533
14534 !! end
14535
14536 ###
14537 ### Parsoid-centric tests for testing RTing of inter-element separators
14538 ### Edge cases not tested by existing parser tests and specific to
14539 ### Parsoid-specific serialization strategies.
14540 ###
14541
14542 !!test
14543 RT-ed inter-element separators should be valid separators
14544 !!input
14545 {|
14546 |- [[foo]]
14547 |}
14548 !!result
14549 <table>
14550
14551 </table>
14552
14553 !!end
14554
14555 !!test
14556 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
14557 (Parsoid-only since PHP parser relies on Tidy for correct output)
14558 !!options
14559 parsoid
14560 !!input
14561 {|
14562 |<small>foo
14563 bar
14564 |}
14565
14566 {|
14567 |<small>foo<small>
14568 |}
14569 !!result
14570 !!end
14571
14572 !!test
14573 Empty TD followed by TD with tpl-generated attribute
14574 !!input
14575 {|
14576 |-
14577 |
14578 |{{echo|style='color:red'}}|foo
14579 |}
14580 !!result
14581 <table>
14582
14583 <tr>
14584 <td>
14585 </td>
14586 <td>foo
14587 </td></tr></table>
14588
14589 !!end
14590
14591 !!test
14592 Indented table with an empty td
14593 !!input
14594 {|
14595 |-
14596 |
14597 |foo
14598 |}
14599 !!result
14600 <table>
14601
14602 <tr>
14603 <td>
14604 </td>
14605 <td>foo
14606 </td></tr></table>
14607
14608 !!end
14609
14610 !!test
14611 Empty TR followed by a template-generated TR
14612 (Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext)
14613 !!options
14614 parsoid
14615 !!input
14616 {|
14617 |-
14618 {{echo|<tr><td>foo</td></tr>}}
14619 |}
14620 !!result
14621 <table>
14622 <tbody>
14623 <tr>
14624 </tr>
14625 <tr>
14626 <td>foo</td></tr></tbody></table>
14627 !!end
14628
14629 ## PHP and parsoid output differ for this, and since this is primarily
14630 ## for testing Parsoid's serializer, marking this Parsoid only
14631 !!test
14632 Empty TR followed by mixed-ws-comment line should RT correctly
14633 !!options
14634 parsoid
14635 !!input
14636 {|
14637 |-
14638 <!--c-->
14639 |-
14640 <!--c--> <!--d-->
14641 |}
14642 !!result
14643 <table>
14644 <tbody>
14645 <tr>
14646 <td> <!--c--></td></tr>
14647 <tr>
14648 <td><!--c--> <!--d--></td></tr>
14649 </table>
14650
14651 !!end
14652
14653 !!test
14654 Multi-line image caption generated by templates with/without trailing newlines
14655 !!options
14656 parsoid
14657 !!input
14658 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
14659 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
14660 !!result
14661 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/index.php?title=Special:Upload&amp;wpDestFile=Foo.jpg" class="new" title="File:Foo.jpg">File:Foo.jpg</a> <div class="thumbcaption">foo\nA\nB\nC</div></div></div>
14662 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/index.php?title=Special:Upload&amp;wpDestFile=Foo.jpg" class="new" title="File:Foo.jpg">File:Foo.jpg</a> <div class="thumbcaption">foo\nA\nB\nC\n\n</div></div></div>
14663
14664 !!end
14665
14666 ## PHP emits broken html for this, and since this is primarily
14667 ## a Parsoid serializer test, marking this Parsoid only
14668 !!test
14669 Improperly nested inline or quotes tags with whitespace in between
14670 !!options
14671 parsoid
14672 !!input
14673 <span> <s>x</span> </s>
14674 ''' ''x''' ''
14675 !!result
14676 <p><span> <s>x</s></span><s> </s>
14677 <b> <i>x</i></b><i> </i></span>
14678 </p>
14679 !!end
14680
14681 TODO:
14682 more images
14683 more tables
14684 character entities
14685 and much more
14686 Try for 100% code coverage